News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

"Call for price"-link disappeared after update to 2.0.12

Started by webzie, October 09, 2012, 17:50:47 PM

Previous topic - Next topic

webzie

When the product-price is left empty and the checkbox for 'Show call for price, when the price is empty' is checked in VM configuration, the link 'call for price'  doesn't show anymore in VM after update to 2.0.12.

In the file '/com_virtuemart/category/default.php' when i looked at the line:
   if(empty($product->prices) and VmConfig::get('askprice',1) and empty($product->images[0]->file_is_downloadable) ){
                     echo JText::_('COM_VIRTUEMART_PRODUCT_ASKPRICE');
                  }
When I changed 'empty($product->prices)' to '!empty($product->prices)', the link appears all of a sudden(with all products of course), implying that the SQL table ..._virtuemart_product_prices is not really empty when the price is set to zero, and it isn't because there is a price of 0.0000 showing in the table since the update and not empty anymore.

is this a bug, or am I doing something wrong?
Thnx

elcoserv

I have exactly the same issue.
I have joomla 2.5.7 and after upgrading virtuemart to 2.0.12b the label "call for price" is disappeared.
I tried many times to activate/deactivate call for price option, delete price and put it again...but without success.
Please help to fix it.

Thanks

Jonski13

Anyone have any luck finding a solution to this?

Ran the update today and the call for price vanishes - which is essential for pretty much all the products at the mo.

Guessing the only way to address this in the short term is to roll back to version 2.0.10?

Thanks

John

webzie

As I stated earlier, it seems that VM in 2.0.12 fills the tables with zero's when the price is empty, so essentially the table is not empty, but there are zero's, before the update the tables were empty. That's my guess, look for yourself in the code.

The call for price link only shows when the prices are empty. I'm not 100% sure about this though. This could be a bug.

elcoserv

Quote from: webzie on October 10, 2012, 18:19:05 PM
As I stated earlier, it seems that VM in 2.0.12 fills the tables with zero's when the price is empty, so essentially the table is not empty, but there are zero's, before the update the tables were empty. That's my guess, look for yourself in the code.

The call for price link only shows when the prices are empty. I'm not 100% sure about this though. This could be a bug.

I dont think so because I have edited these fields from SQL database phpmyadmin and just erased all zeros and left fields empty. But still have a same problem

ceekee

I have the same problem with this version. The field $this->product->prices is never empty !!! With or without a price it is filled with what I don't know

I have changed the code to:

       if ($this->product->prices <> 0) {      
           echo $this->product->prices, 'TEST';
     ?>


When i echo this field I a getting the following output: "ArrayTEST "

I am getting this output, with and without a price.

Please advice.

webzie

Thnak you for reply, can you output the contents of the prices-array? Maybe product ID is in the array?

webzie

if you change  if(empty($product->prices) into  if(empty($product->prices[basePrice]) you will get the link back in category view. Later i will check how to het the link back in productview.

ceekee

Here is the array of $this->product:
[prices] => Array (
[costPrice] => 0
[basePrice] => 0
[basePriceVariant] =>
[basePriceWithTax] =>
[discountedPriceWithoutTax] =>
[priceBeforeTax] =>


ceekee

Quote from: webzie on October 11, 2012, 09:24:07 AM
if you change  if(empty($product->prices) into  if(empty($product->prices[basePrice]) you will get the link back in category view. Later i will check how to het the link back in productview.

You also have to change the add to cart piece in the default.php

// Add To Cart Button
// if (!empty($this->product->prices) and !empty($this->product->images[0]) and $this->product->images[0]->file_is_downloadable==0 ) {
if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices)) {
    echo $this->loadTemplate('addtocart');
}  // Add To Cart Button END
?>


ceekee


webzie

For now my final solution to get the link back in productview en category view, only when the baseprice for a product is zero, is a hack in the code in the next two files:
- /components/com_virtuemart/views/productdetails/tmpl/default_showprices.php
replaceif (empty($this->product->prices) and VmConfig::get ('askprice', 1) and !$this->product->images[0]->file_is_downloadable) withif (empty($this->product->prices[basePrice]) and VmConfig::get ('askprice', 1)  and !$this->product->images[0]->file_is_downloadable)

And in:
- /components/com_virtuemart/views/category/tmpl/default.php

replaceif(empty($product->prices) and VmConfig::get('askprice',1) and empty($product->images[0]->file_is_downloadable) )
withif(empty($product->prices[basePrice]) and VmConfig::get('askprice',1) and empty($product->images[0]->file_is_downloadable) )

The "call for price"-link will only show when you did not enter a price. If you use a template put it in the template-html of course.

ceekee

Quote from: webzie on October 11, 2012, 15:05:42 PM
For now my final solution to get the link back in productview en category view, only when the baseprice for a product is zero, is a hack in the code in the next two files:
- /components/com_virtuemart/views/productdetails/tmpl/default_showprices.php
replaceif (empty($this->product->prices) and VmConfig::get ('askprice', 1) and !$this->product->images[0]->file_is_downloadable) withif (empty($this->product->prices[basePrice]) and VmConfig::get ('askprice', 1)  and !$this->product->images[0]->file_is_downloadable)

And in:
- /components/com_virtuemart/views/category/tmpl/default.php

replaceif(empty($product->prices) and VmConfig::get('askprice',1) and empty($product->images[0]->file_is_downloadable) )
withif(empty($product->prices[basePrice]) and VmConfig::get('askprice',1) and empty($product->images[0]->file_is_downloadable) )

The "call for price"-link will only show when you did not enter a price. If you use a template put it in the template-html of course.

Thank you Webzie, your fix took care of the problem. Much appreciated.