Jump to content

[SOLVED] Shopping Cart overview is showing qty in stock instead of ordered quantity


Recommended Posts

Hi All,

After installing a third party theme, I noticed that the quantity displayed in the shopping cart overview is the quantity available in stock and not the quantity ordered by the customer.
When switching to the PS theme everything is OK.

When checking the shopping cart template the following parameter is used: {l s='Qty'}. I believe this is correct, nbut instead it is displaying the available stock.

Screenshot attached,

Thanks in advance for your help.

Manuel

quantity available instead of ordered.pdf

Link to comment
Share on other sites

It's an old bug that was fixed a long time ago. You must be using an old theme that was created before the bug was fixed. You need to search in shopping-cart-product-line.tpl for $product.quantity and change it to $product.cart_quantity

Link to comment
Share on other sites

Thanks for the quick reaction Rocky,
Is this what you mean?

                

                   {assign var='quantityDisplayed' value=$quantityDisplayed+$customization.quantity}
               {/foreach}
               {* If it exists also some uncustomized products *}
               {if $product.quantity-$quantityDisplayed > 0}{include file=$tpl_dir./shopping-cart-product-line.tpl}{/if}
           {/if}
       {/foreach}

Link to comment
Share on other sites

No. Here's what's on line 26 on my site:


{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}



Notice how it says $product.cart_quantity. On older versions of PrestaShop, it was $product.quantity, which was incorrect.

Link to comment
Share on other sites

I run Prestashop 1.3.1., but for sure my theme is older and that could explain the bug.
However I can't find the line you refer to, neither in the original PS theme.

The only referring to $product.quantity is the one I mentioned above (checked with agent ransack)

Is there anything else I can try.
As said, with the PS theme activated it displays correctly, so the problem has to be in the template I believe.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

hi rocky, i tried to replace the code but the problem still persists. would you help me take a look at my code:


getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">getImageLink($product.link_rewrite, $product.id_image, 'small')}" alt="{$product.name|escape:'htmlall':'UTF-8'}" />


getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}
       {if $product.attributes}getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.attributes|escape:'htmlall':'UTF-8'}{/if}

{if $product.reference}{$product.reference|escape:'htmlall':'UTF-8'}{else}--{/if}

       {if $product.active AND ($product.allow_oosp OR $product.stock_quantity > 0)}

       {else}

       {/if}



           {convertPrice price=$product.price} {l s='-Tx'}



       {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}{$product.customizationQuantityTotal}{/if}
       {if !isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0}


{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}



       {/if}



           {if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}
               {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.total_customization_wt}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if}{if $priceDisplay == 2}
{/if}
               {if $priceDisplay}{convertPrice price=$product.total_customization}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if}
           {else}
               {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.total_wt}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if}{if $priceDisplay == 2}
{/if}
               {if $priceDisplay}{convertPrice price=$product.total}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if}
           {/if}





thanks

Link to comment
Share on other sites

Here's what I have in my file:



       <a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small')}" alt="{$product.name|escape:'htmlall':'UTF-8'}" width="{$smallSize.width}" height="{$smallSize.height}" />


<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}
       {if $product.attributes}<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.attributes|escape:'htmlall':'UTF-8'}{/if}

{if $product.reference}{$product.reference|escape:'htmlall':'UTF-8'}{else}--{/if}

       {if $product.active AND ($product.allow_oosp OR ($product.quantity <= $product.stock_quantity))}
           <img src="{$img_dir}icon/available.gif" alt="{l s='Available'}" width="14" height="14" />
       {else}
           <img src="{$img_dir}icon/unavailable.gif" alt="{l s='Out of stock'}" width="14" height="14" />
       {/if}



           {if !$priceDisplay}{convertPrice price=$product.price_wt}{else}{convertPrice price=$product.price}{/if}



       {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}{$product.customizationQuantityTotal}{/if}
       {if !isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0}
           <a class="cart_quantity_delete" href="{$base_dir_ssl}cart.php?delete&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&token={$token_cart}" title="{l s='Delete'}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" class="icon" width="11" height="13" />

{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}
           <a class="cart_quantity_up" href="{$base_dir_ssl}cart.php?add&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&token={$token_cart}" title="{l s='Add'}"><img src="{$img_dir}icon/quantity_up.gif" alt="{l s='Add'}" width="14" height="9" />

           <a class="cart_quantity_down" href="{$base_dir_ssl}cart.php?add&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&op=down&token={$token_cart}" title="{l s='Subtract'}"><img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9"/>
       {/if}



           {if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}
               {if !$priceDisplay}{displayPrice price=$product.total_customization_wt}{else}{displayPrice price=$product.total_customization}{/if}
           {else}
               {if !$priceDisplay}{displayPrice price=$product.total_wt}{else}{displayPrice price=$product.total}{/if}
           {/if}



Link to comment
Share on other sites

hi rocky, thanks for the fast reply..

unfortunately, something went wrong at my shopping cart summary after i used your code. i have attached a file for your viewing.

and the paypal quantity is still showing the stock quantity :(

your help is much appreciated, rocky.

32019_czgvDwgdAoLZJ53jFT7a_t

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