Jump to content

Hard coding text for products with no price - Issues since upgrading to v6


afalls

Recommended Posts

Hi,

I have recently upgraded to v6 and since then i have experienced some issues around custom coded features that worked on previously versions of cubecart.

The site is catalog only (has been running for several years now), currently has v6.0.6 and is using a modified foundation skin.

I got some help from this forum in the past which has resulted in some hard coding being added in so all prices are displayed with "+ GST". For products with no price "Call for price" displays. The issue since upgrading from v5 to v6 is that now for products with no price it displays "Call for price + GST".

catalogue.class.php
I replaced this line of code:
$product['price'] = $GLOBALS['tax']->priceFormat($product['price']);

with this:
if ($product['price'] == "0.00") {
    $product['price'] = "Call for price";
    } else {
    $product['price'] = $GLOBALS['tax']->priceFormat($product['price']);
    }


cubecart.class.php
I replaced this line of code:
$product['price'] = $GLOBALS['tax']->priceFormat($product['price']);

with this:

if ($product['price'] == "0.00") {
    $product['price'] = "Call for price";
    } else {
    $product['price'] = $GLOBALS['tax']->priceFormat($product['price']);
    }

In the skin template files - content.category.php and content.product.php, i have the following code in to display the price

{if $product.ctrl_sale}<span class="old_price">{$product.price}{if $product.price_unformatted ne "0.00"} + GST{/if}</span> <span class="sale_price">{$product.sale_price}</span>
    {else}
    {$product.price}{if $product.price_unformatted ne "0.00"} + GST{/if}
 {/if}

 

If anyone has any ideas why this is now occurring and a fix i would really appreciate it.

Thanks

 

 

 

Edited by afalls
Link to comment
Share on other sites

In the skin template 'main.php', at the end, add {debug}. This will cause the browser to popup a window with all the skin variables and their values.

Find $PRODUCTS and look through the array for the real value of price_unformatted.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...