magento - Do not show string if value is equal or greater than another -
it necessary hide oldprice
string if value of string equal or greater price
string.
what correct syntax string oldprice
?
// save product data result array $result['products'][] = array( 'id' => $_product->getid(), 'in_stock' => (bool)mage::getmodel('cataloginventory/stock_item')->loadbyproduct($_product)->getisinstock(), 'url' => str_replace('/index.php', null, $result['shop_data']['url']) . $_product->geturlkey() . $helper->getproducturlsuffix(), 'price' => $_product->getfinalprice(), 'oldprice' => $_product->getprice(), 'currencyid' => $currencycode, 'categoryid' => $_category->getid(), 'picture' => $picurl, 'name' => $_product->getname(), 'vendor' => trim($_product->getattributetext('manufacturer')), 'model' => $_product->getsku(), 'description' => trim(strip_tags($_product->getshortdescription())), 'local_delivery_cost' => $priceship[0], 'market_category' => trim($_product->getattributetext('market_category')), 'country_of_origin' => trim($_product->getattributetext('country_of_manufacture')), 'local_delivery_cost' => 500, 'sales_notes' => '100% предоплата', );
you this:
'oldprice' => ($_product->getprice() >= $_product->getfinalprice() ? 0 : $_product->getprice())
or calculation beforehand
$oldprice = null; if ($_product->getprice() >= $_product->getfinalprice()) { $oldprice = $_product->getprice(); } ... 'oldprice' => $oldprice
however, wouldn't stop value being saved array (in case 0), you'd still need logic you're echoing out.
Comments
Post a Comment