News:

Looking for documentation? Take a look on our wiki

Main Menu

No override price displayed when baseprice/costprice is blank? VM2.0.6

Started by randomdev, August 08, 2012, 03:43:38 AM

Previous topic - Next topic

randomdev

I posted this in general but perhaps belongs in this forum?

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


jjk

First you should update to version 2.0.10 or 2.0.11 (2.0.6 is outdated). Concerning your problem - the only price which is stored in VM2 is the cost price. All other prices are calculated. So, if you don't enter a cost price, you should check "calculate the cost price". I suppose once you have a stored price, you can override it. (Never tried that myself, because I don't get my products for free, so all of them have a cost price:-)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations