Guest GabrielSolis Posted September 4, 2008 Share Posted September 4, 2008 How can I Replace Normal Price number when it is 0.00 with "Inquire about this item The client wants the prices for some and the statement "inquire about this item" if the product price is 0.00 Any help is GREATLY appreciated! :sourcerer: Quote Link to comment Share on other sites More sharing options...
Ausy Posted September 4, 2008 Share Posted September 4, 2008 You need a mod, there is one for this specific task, ask here http://www.cubecartforums.org/index.php?act=idx Quote Link to comment Share on other sites More sharing options...
Guest Brivtech Posted September 7, 2008 Share Posted September 7, 2008 There's 2 page types where this occurs (excluding the basket): - viewCat - viewProd let's say you want to do this on viewCat... First, find where the information that's being generated comes from - What is the name of the field being parsed to the template file? So (using Classic as an example template), open: skins/Classic/styleTemplates/content/viewCat.tpl You'll see this field that displays the normal price: {TXT_PRICE} (On line 34) Now that you know what the field you're dealing with is, you need to go to the inc.php version of this file to find the php code that creates the data to parse to the template file. In this case, open: includes/content/viewCat.tpl Look for the field within the code (no curly brackets now), and here's what you find: There's a block of code at line 255: if(salePrice($productResults[$i]['price'], $productResults[$i]['sale_price'])==FALSE){ $view_cat->assign("TXT_PRICE",priceFormat($productResults[$i]['price'])); } else { $view_cat->assign("TXT_PRICE","<span class='txtOldPrice'>".priceFormat($productResults[$i]['price'])."</span>"); } You'll see TXT_PRICE is in there twice. The condition of this block is to display the price normally if there's no sale price, else display it differently if there is a sale price. All you need to do is add in an extra condition on whether the price is zero or not, and depending on this, display either some text, or the price respectively. I've changed the second line in the block of code above to accomodate this condition (assuming that if there was a sale price, then the normal price surely much be more than zero). New code: if(salePrice($productResults[$i]['price'], $productResults[$i]['sale_price'])==FALSE){ if ($productResults[$i]['price'] == 0) { $view_cat->assign("TXT_PRICE","Please Enquire")); } else { $view_cat->assign("TXT_PRICE",priceFormat($productResults[$i]['price'])); }; } else { $view_cat->assign("TXT_PRICE","<span class='txtOldPrice'>".priceFormat($productResults[$i]['price'])."</span>"); } These principals are identical for version 4 of CubeCart as well, although there may be some differences in the actual code (and therefore line numbering as well). Please note that I haven't tested the code in the above example, so it may contain errors. It's intended as a guide, not a tested working solution. As Ausy mentioned, cubecartforums.org is a good resource for modding code, with some common mods already available. Quote Link to comment Share on other sites More sharing options...
Guest GabrielSolis Posted September 10, 2008 Share Posted September 10, 2008 Awesome! Thanks! the code works like a champ ( I had to remove 1 bracket) I tried doing it for the viewProd.inc.php to no avail....here is that code...Where and what do I replace? <!-- BEGIN: view_prod --> <div class="boxContent"> <!-- BEGIN: prod_true --> <strong>{LANG_DIR_LOC}</strong> {CURRENT_DIR} <form action="{CURRENT_URL}" method="post" name="addtobasket" target="_self"> <p class="txtContentTitle"><strong>{TXT_PRODTITLE}</strong></p> <div style="text-align: center;"><img src="{IMG_SRC}" alt="{TXT_PRODTITLE}" border="0" title="{TXT_PRODTITLE}" /></div> <!-- BEGIN: more_images --> <div style="text-align: center;"><a href="java script:openPopUp('extra/prodImages.php?productId={PRODUCT_ID}', 'images', 548, 455, 0);" class="txtDefault">{LANG_MORE_IMAGES}</a></div> <!-- END: more_images --> <p> <strong>{LANG_PRODINFO}</strong> <br /> {TXT_DESCRIPTION} </p> <p> <strong>{LANG_PRICE}</strong> {TXT_PRICE} <span class="txtSale">{TXT_SALE_PRICE}</span> </p> <ul> <li class="bulletLrg"><a href="index.php?act=taf&productId={PRODUCT_ID}" target="_self" class="txtDefault">{LANG_TELLFRIEND}</a></li> </ul> <!-- BEGIN: prod_opts --> <br /> <strong>{TXT_PROD_OPTIONS}</strong> <table border="0" cellspacing="0" cellpadding="3"> <!-- BEGIN: repeat_options --> <tr> <td><strong>{VAL_OPTS_NAME}</strong></td> <td> <select name="productOptions[]"> <!-- BEGIN: repeat_values --> <option value="{VAL_ASSIGN_ID}"> {VAL_VALUE_NAME} <!-- BEGIN: repeat_price --> ({VAL_OPT_SIGN}{VAL_OPT_PRICE}) <!-- END: repeat_price --> </option> <!-- END: repeat_values --> </select> </td> </tr> <!-- END: repeat_options --> </table> <!-- END: prod_opts --> <br /> <strong>{LANG_PRODCODE}</strong> {TXT_PRODCODE} <div> {TXT_INSTOCK}<span class="txtOutOfStock"> {TXT_OUTOFSTOCK} </span> <!-- BEGIN: buy_btn --> <div style="position: relative; text-align: right;"></div> <!-- END: buy_btn --> </div> <input type="hidden" name="add" value="{PRODUCT_ID}" /> </form> <!-- END: prod_true --> <!-- BEGIN: prod_false --> <p>{LANG_PRODUCT_EXPIRED}</p> <!-- END: prod_false --> </div> <!-- END: view_prod --> There's 2 page types where this occurs (excluding the basket): - viewCat - viewProd let's say you want to do this on viewCat... First, find where the information that's being generated comes from - What is the name of the field being parsed to the template file? So (using Classic as an example template), open: skins/Classic/styleTemplates/content/viewCat.tpl You'll see this field that displays the normal price: {TXT_PRICE} (On line 34) Now that you know what the field you're dealing with is, you need to go to the inc.php version of this file to find the php code that creates the data to parse to the template file. In this case, open: includes/content/viewCat.tpl Look for the field within the code (no curly brackets now), and here's what you find: There's a block of code at line 255: if(salePrice($productResults[$i]['price'], $productResults[$i]['sale_price'])==FALSE){ $view_cat->assign("TXT_PRICE",priceFormat($productResults[$i]['price'])); } else { $view_cat->assign("TXT_PRICE","<span class='txtOldPrice'>".priceFormat($productResults[$i]['price'])."</span>"); } You'll see TXT_PRICE is in there twice. The condition of this block is to display the price normally if there's no sale price, else display it differently if there is a sale price. All you need to do is add in an extra condition on whether the price is zero or not, and depending on this, display either some text, or the price respectively. I've changed the second line in the block of code above to accomodate this condition (assuming that if there was a sale price, then the normal price surely much be more than zero). New code: if(salePrice($productResults[$i]['price'], $productResults[$i]['sale_price'])==FALSE){ if ($productResults[$i]['price'] == 0) { $view_cat->assign("TXT_PRICE","Please Enquire")); } else { $view_cat->assign("TXT_PRICE",priceFormat($productResults[$i]['price'])); }; } else { $view_cat->assign("TXT_PRICE","<span class='txtOldPrice'>".priceFormat($productResults[$i]['price'])."</span>"); } These principals are identical for version 4 of CubeCart as well, although there may be some differences in the actual code (and therefore line numbering as well). Please note that I haven't tested the code in the above example, so it may contain errors. It's intended as a guide, not a tested working solution. As Ausy mentioned, cubecartforums.org is a good resource for modding code, with some common mods already available. Quote Link to comment Share on other sites More sharing options...
Guest GabrielSolis Posted September 11, 2008 Share Posted September 11, 2008 Works Now ....How about viewProd? Here's what I coded in viewprod.inc.php...but it still shows number.... if(salePrice($prodArray[0]['price'], $prodArray[0]['sale_price'])==FALSE){ if ($prodArray[0]['price'] == 0) { $view_prod->assign("TXT_PRICE","Contact Us Below For Price"); } else { $view_prod->assign("TXT_PRICE",priceFormat($productResults[0]['price'])); }; $view_prod->assign("TXT_PRICE",priceFormat($prodArray[0]['price'])); } else { $view_prod->assign("TXT_PRICE","<span class='txtOldPrice'>".priceFormat($prodArray[0]['price'])."</span>"); Thanks So Much in advance...I've spent a couple hours on this and my head hurts. There's 2 page types where this occurs (excluding the basket): - viewCat - viewProd let's say you want to do this on viewCat... First, find where the information that's being generated comes from - What is the name of the field being parsed to the template file? So (using Classic as an example template), open: skins/Classic/styleTemplates/content/viewCat.tpl You'll see this field that displays the normal price: {TXT_PRICE} (On line 34) Now that you know what the field you're dealing with is, you need to go to the inc.php version of this file to find the php code that creates the data to parse to the template file. In this case, open: includes/content/viewCat.tpl Look for the field within the code (no curly brackets now), and here's what you find: There's a block of code at line 255: if(salePrice($productResults[$i]['price'], $productResults[$i]['sale_price'])==FALSE){ $view_cat->assign("TXT_PRICE",priceFormat($productResults[$i]['price'])); } else { $view_cat->assign("TXT_PRICE","<span class='txtOldPrice'>".priceFormat($productResults[$i]['price'])."</span>"); } You'll see TXT_PRICE is in there twice. The condition of this block is to display the price normally if there's no sale price, else display it differently if there is a sale price. All you need to do is add in an extra condition on whether the price is zero or not, and depending on this, display either some text, or the price respectively. I've changed the second line in the block of code above to accomodate this condition (assuming that if there was a sale price, then the normal price surely much be more than zero). New code: if(salePrice($productResults[$i]['price'], $productResults[$i]['sale_price'])==FALSE){ if ($productResults[$i]['price'] == 0) { $view_cat->assign("TXT_PRICE","Please Enquire")); } else { $view_cat->assign("TXT_PRICE",priceFormat($productResults[$i]['price'])); }; } else { $view_cat->assign("TXT_PRICE","<span class='txtOldPrice'>".priceFormat($productResults[$i]['price'])."</span>"); } These principals are identical for version 4 of CubeCart as well, although there may be some differences in the actual code (and therefore line numbering as well). Please note that I haven't tested the code in the above example, so it may contain errors. It's intended as a guide, not a tested working solution. As Ausy mentioned, cubecartforums.org is a good resource for modding code, with some common mods already available. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.