Jump to content

Specials in a basic slider


redelectric

Recommended Posts

Hi Everyone.

Looking at some of the showcase sites, I think the customisations people have done are amazing.

I would like to have the specials appear in a basic sort of slider. I have searched the forum for a way to do this, but Can't seem to find an answer.

I don't want anything too fancy, just a basic sort of slider with a next and back sort of thing. is this possible? and could anybody point me in the right direction.

I know how to install a slider on a html site, but just can't seem to get my head around how to make it work on the specials in prestashop

(which is awesome software, and probably the best Ive found)

Many thanks..

Martin

Link to comment
Share on other sites

Do a search for "slider" on the forums and you should find a few sliders on the forums. I've just written a slider for a client and I am planning to turn it into a module soon. You can see the slider in action here. Would you be interested in a slider like that?

Link to comment
Share on other sites

Hi Rocky

Thanks for your reply..

I like your site, I'm a huge fan of a more minimilistic style and white space. It looks great, nice T's too. And... that's an awesome looking slider. Works really well on your site.

I almost kinda figured it out. I looked in editorial.tpl and see they implemented the slider javascript in there, so I figured I could just do the same for the specials etc?. I always try and figure stuff out for myself before I hit the forums as it's a good way to learn, but there's just sooo many different files:O

Not sure on the exact style of slider my client wants, but I will show him your site:)

Gonna do that search now

Thanks!

M

Link to comment
Share on other sites

Thanks Rocky!..

Thanks for the replies..

When you say call the function do you mean, put the <?php (function) ?> where I want the specials to display?.. that's awesome as apparently there will only be a couple of specials each week. Will go and have a mess with it now.

thanks again, I really appreciate this.

M

Link to comment
Share on other sites

No, you should call the function in the PHP file, then pass the result into TPL. For example, in the PHP file that calls the TPL, put:

$specials = Product::getPricesDrop($cookie->id_lang, 1, 10);
$smarty->assign('specials', $specials);



Then you can use code like the following in the TPL:

{foreach from=$specials item=special}
{$special.name} {$special.price_without_reduction} {$special.price} {$special.reduction_percent}
{/foreach}



Of course, you'll need to add HTML to format it, but it will display the product's name, price without reduction, price with reduction and the reduction percent.

Link to comment
Share on other sites

$specials = Product::getPricesDrop($cookie->id_lang, 1, 10);
$smarty->assign('specials', $specials); 




ok its show my 10 produkct but if i want see 10 random produkt for example in first show i have 1 2 3 4 5 6 7 8 9 10 and refres 21 22 23 24 25 26 27 28 40 42

its posible to make??

change $product in homefeatured.php to

$products = $category->getProducts(intval($params['cookie']->id_lang), 1, ($nb ? $nb : 10), $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $random = true, $randomNumberProducts = 6 );

$random = true - then produkts is random
$randomNumberProducts = 6 - how many produkcts will be in random!

Link to comment
Share on other sites

  • 6 months later...

I used homefeatured as template and followed the instruction above.

added to homespecials.php

function hookHome($params)
   {
       global $smarty;

$specials = Product::getPricesDrop($cookie->id_lang, 1, 10);
$smarty->assign('specials', $specials); 

return $this->display(__FILE__, 'homespecials.tpl');


and homespecials.tpl

{foreach from=$specials item=special}
{$special.name} {$special.price_without_reduction} {$special.price} {$special.reduction_percent}
{/foreach} 


but this does not display anything :(
where is the mistake?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...