News:

Looking for documentation? Take a look on our wiki

Main Menu

No override prices displayed when baseprice/costprice is blank? vm2.0.6

Started by randomdev, August 07, 2012, 06:38:09 AM

Previous topic - Next topic

randomdev

I currently have the code below for the product price display, but when baseprice/costprice is 0, the override price is not displayed?
e.g. echo "Salesprice: ".$this->product->prices['salesPrice']."<br />"; shows nothing also.
When baseprice has a value the override price and discount etc are displayed.


echo $this->currency->createPriceDiv ( 'variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $this->product->prices );
echo $this->currency->createPriceDiv ( 'basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices );
echo $this->currency->createPriceDiv ( 'discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE', $this->product->prices );
echo $this->currency->createPriceDiv ( 'salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $this->product->prices );
echo $this->currency->createPriceDiv ( 'priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices );
echo $this->currency->createPriceDiv ( 'discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $this->product->prices );
echo $this->currency->createPriceDiv ( 'taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $this->product->prices );
echo $this->currency->createPriceDiv ( 'salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $this->product->prices );


The html looks like this:
<div id="productPrice8613" class="product-price"> </div>

Any ideas how I can fix this?

Thank You

Edit: It looks like the cause is administrator\components\com_virtuemart\helpers\calculationh.php line 244 (if (!empty($row['product_price'])) )? But I am unsure what effect changing this will have on other parts of the extension?
vmSetStartTime('getProductCalcs');
$this->_db->setQuery('SELECT * FROM #__virtuemart_product_prices  WHERE `virtuemart_product_id`="' . $productId . '" ');
$row = $this->_db->loadAssoc();
if ($row) {
if (!empty($row['product_price'])) {
$costPrice = $row['product_price'];
$this->productCurrency = $row['product_currency'];
$override = $row['override'];
$product_override_price = $row['product_override_price'];
$this->product_tax_id = $row['product_tax_id'];
$this->product_discount_id = $row['product_discount_id'];
} else {
$app = Jfactory::getApplication();
$app->enqueueMessage('cost Price empty, if child, everything okey, this is just a dev note');
return false;
}
}

randomdev