Jump to content

HELP: New Products & Top Sellers modules


Recommended Posts

Hello,

I managed to make my Top Seller module to display each product with its image and price. But as if the title is long then the price will go under the picture. Is there any way to shorter the title automatically with '...'? And I would like to do the same for New Products (with random display as well)

Thanks!

22100_Xf6cGzgi0rzYYEkcCfN9_t

Link to comment
Share on other sites

Try to replace

$new_products.0



with

$product



So from this

{if !$priceDisplay || $priceDisplay == 2}{displayWtPrice p=$new_products.0.price}{if $priceDisplay == 2} {l s='s DPH'}{/if}{/if}
               {if $priceDisplay == 2}
{/if}
               {if $priceDisplay}{displayWtPrice p=$new_products.0.price_tax_exc}{if $priceDisplay == 2} {l s='bez DPH'}{/if}{/if}



to this

{if !$priceDisplay || $priceDisplay == 2}{displayWtPrice p=$product.price}{if $priceDisplay == 2} {l s='s DPH'}{/if}{/if}
               {if $priceDisplay == 2}
{/if}
               {if $priceDisplay}{displayWtPrice p=$product.price_tax_exc}{if $priceDisplay == 2} {l s='bez DPH'}{/if}{/if}

Link to comment
Share on other sites

To display tax excluded you need to change blockbestsellers.php in modules/blockbestsellers.
So first make backup.
Add following line after line 40

        $bestseller['price_tax_exc'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product']),false), $currency); 


so that part of code looks like

        foreach ($bestsellers AS $bestseller)
       {
           $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product'])), $currency);
           $bestseller['price_tax_exc'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product']),false), $currency);
           $best_sellers[] = $bestseller;
       }



Then changes from previous post will work.
Another thing for text in blockbestsellers.tpl .Should look like this

{l s='s DPH' mod='blockbestsellers'}
and
{l s='bez DPH' mod='blockbestsellers'}

Link to comment
Share on other sites

Don't know really, it works for me on local server.

Try to delete all files from prestashop\tools\smarty\compile folder except index.php.

And try different settings for Price display in
Back Office >> Preferences >> Products

Link to comment
Share on other sites

I think i got it.
I changed in blockbestsellers.php from

    $bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 5);


to

       $bestsellers = ProductSale::getBestSales(intval($params['cookie']->id_lang), 0, 5);



and deleted these two lines

            $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product'])), $currency);
           $bestseller['price_tax_exc'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product']),false), $currency);



and in tpl file replaced price part with this

            {if !$priceDisplay}{convertPrice price=$bestSellerProduct.price}{l s=' s DPH' mod='blockbestsellers'}
                                    {else}{convertPrice price=$bestSellerProduct.price_tax_exc}{l s=' bez DPH' mod='blockbestsellers'}{/if}



Hope it works for you.And to change price with/out tax go to
Back Office » Customers » Groups and edit .

blackbestsellers.zip

Link to comment
Share on other sites

  • 2 weeks later...

Thanks,

works almost perfect & and I like the idea to add the cart-button.

But the prices are shown without tax. Any idea how to show the inclusive-prices?
EDIT: only in blockbestsellers the prices are without tax. Blocknewproducts works fine - I have no idea why

ZaC

Link to comment
Share on other sites

Hi Zac,

I could have looked at it if my internet was working at home. Unfortunately my internet is down for 2 days now. Hopefully I will get it back tonight, meanwhile you should see if anybody else can give you some help here.

Link to comment
Share on other sites

BTW anson.c,

I just recognised that clicking the tiny cart button within a block does not move the correct product into the cart.
It seems you have the same problem.
You'd better check it out...

regards, ZaC

Link to comment
Share on other sites

I guess the fix is concerning the cart button.
It works fine for bestsellers, but not for new_products. It says something like 'wrong token' (Free translation, don't use the english version)

Concerning the price I still have the prices without tax in the bestsellers block.

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...