VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: randomdev on November 22, 2012, 03:43:54 AM

Title: Custom field do not display when product price is 0?
Post by: randomdev on November 22, 2012, 03:43:54 AM
vm2.0.14

I am not sure if this is intentional or not, but when the products price is 0 none of the custom fields will display?
If this is intentional how would I modify this behaviour?

I also noticed the add to cart bar does not appear (which seems strange as there is a language description for free products?).
Title: Re: Custom field do not display when product price is 0?
Post by: randomdev on November 22, 2012, 07:02:55 AM
Well this one was easy to fix :

I removed the salesPrice check from the following on the productdetails default view:
if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices['salesPrice'])) {
Title: Re: Custom field do not display when product price is 0?
Post by: Pushmanz on December 18, 2012, 08:06:36 AM
it's a fix, BUT....

I have the same problem using the custom field for PRICE BY LETTER . When i ad letters to the text box it calculates the price fine but the initial product price is added.
When the product price is 2 euro per letter it displays 2 euro and if i start typing letters in the text box it keeps adding 2 euros per letter. The first letter should not be calculated or I should be able to set te base price to 0 euro and still display the custom field.

I don't like to alter de code....i think the plugin needs work.

Any ideas on this?
Title: Re: Custom field do not display when product price is 0?
Post by: PolishedGeek on December 18, 2012, 15:11:15 PM
The code that is being altered is core VM, not the plugin. Core VM doesn't (currently) allow you to display custom fields when the starting price is zero. The hack works around that, enabling various custom field plugins to work (like our Breezing Forms Custom Fields extension). 
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 18, 2012, 22:11:36 PM
Hello I tried to delete salesPrice but nothing has changed, I would need at zero cost I can choose variants cart.
I enclose part of the code, if you can help me understand what needs to change for this solution, thanks

[attachment cleanup by admin]
Title: Re: Custom field do not display when product price is 0?
Post by: randomdev on December 19, 2012, 03:20:07 AM
You need to remove this (I can still see it in the image posted):
and !empty($this->product->prices['salesPrice'])

That will remove the check for an empty salesprice.


Before: if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices['salesPrice'])) {
After: if (!VmConfig::get('use_as_catalog', 0)) {
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 19, 2012, 21:55:26 PM
I modified the code as you wrote but I get the sale price, I will still be there, but it is zero, this is the result after editing code as I have shown you, help me please, thank you

[attachment cleanup by admin]
Title: Re: Custom field do not display when product price is 0?
Post by: randomdev on December 20, 2012, 02:24:44 AM
I am not sure exactly what you want to do, but it sounds like you dont want to display the price if it is 0 but show the custom variants?

On my site I have a check above the product-price div to not display it if salesprice is 0.


if ($this->show_prices and !empty($this->product->prices['salesPrice'])) { ?>
<div class="product-price" id="productPrice<?php echo $this->product->virtuemart_product_id ?>">
etc etc


Title: Re: Custom field do not display when product price is 0?
Post by: Milbo on December 20, 2012, 13:05:38 PM
Quote from: randomdev on November 22, 2012, 03:43:54 AM
vm2.0.14

I am not sure if this is intentional or not, but when the products price is 0 none of the custom fields will display?
If this is intentional how would I modify this behaviour?

I also noticed the add to cart bar does not appear (which seems strange as there is a language description for free products?).

That the add to cart is not there, that is imho correct, depends on your settings (Ask price or not). It is not intentional as I said in another post, the customfields were not written by me.

Next vm2.2 they will better, promised.
Quote from: Pushmanz on December 18, 2012, 08:06:36 AM
it's a fix, BUT....

I have the same problem using the custom field for PRICE BY LETTER . ...........
I don't like to alter de code....i think the plugin needs work.

Any ideas on this?

Yes, I alter the code completly official :-)
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 20, 2012, 13:06:33 PM
Hello, thanks for the reply, I want from price 0 and let the price is updated when choosing variants cart, you can?
Title: Re: Custom field do not display when product price is 0?
Post by: Milbo on December 20, 2012, 13:22:47 PM
Please test with this, location \components\com_virtuemart\views\productdetails\tmpl

[attachment cleanup by admin]
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 20, 2012, 13:38:50 PM
Tried your code, you see the price

This happens to me when I set the product price 0

[attachment cleanup by admin]
Title: Re: Custom field do not display when product price is 0?
Post by: Milbo on December 20, 2012, 13:49:19 PM
btw, IF you use the istraxx customsize plugin, then you can solve the problem different.

Example: Set as product price the net price for a 100 cm²,... set offset 100 and check "use offset as unit". This is also a typical support question for our ticket system http://extensions.virtuemart.net/ticket

But here the adjusted file

[attachment cleanup by admin]
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 20, 2012, 13:57:17 PM
You use customsize istraxx. So I have to replace this file with the other two?
Title: Re: Custom field do not display when product price is 0?
Post by: Milbo on December 20, 2012, 14:06:25 PM
the file has another name, to remove the title of the prices, we need to modify the third file.

I just explained, that it looks like you use the customsize istraxx plugin, which is written and sold by istraxx/me. I just wanted explain that you can use the offset and the "use offset as unit" to reach the same thing. Even better.
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 20, 2012, 14:32:27 PM
so if you do not want to change offset customsize istraax, what should I do? thanks

Title: Re: Custom field do not display when product price is 0?
Post by: Milbo on December 20, 2012, 19:41:48 PM
Use the latest http://dev.virtuemart.net/projects/virtuemart/files
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 21, 2012, 00:14:12 AM
This version contains the update I need?
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 21, 2012, 16:30:50 PM
I installed the latest version of virtuemart 2.0.16, now I want to set the price to zero variants cart I determine the final price, it is possible with this new version or you have to change the code? thanks

I sell customized products, tents, the price is determined by the extent that the customer choose
Title: Re: Custom field do not display when product price is 0?
Post by: Milbo on December 21, 2012, 16:42:00 PM
? The 2.0.16 has all the changes, remove your layout overrides.
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 21, 2012, 16:57:51 PM
I'm doing several tests, as you can see from the the price is zero but I need that when I use Istraxx customsize must raise the price and not the discount, what settings should I use?

[attachment cleanup by admin]
Title: Re: Custom field do not display when product price is 0?
Post by: Milbo on December 21, 2012, 17:02:16 PM
Grisu, you may write me a ticket here http://extensions.virtuemart.net/ticket. I think it is better to work with the offset. I have no clue about your tax or discount settings.
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 21, 2012, 17:21:44 PM
but excuse me if I insist but Istraxx customsize has nothing to do, I just have from zero price and virtuemart does not allow me this, nothing complicated
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 21, 2012, 17:54:55 PM
Quote from: Grisu74 on December 21, 2012, 17:21:44 PM
but excuse me if I insist but Istraxx customsize has nothing to do, I just have from zero price and virtuemart does not allow me this, nothing complicated

In regard to a reply in another topic:
http://forum.virtuemart.net/index.php?topic=111315.0

If the prices is <=0.0 and you have "ask for price" in the config activated, then you see this. Maybe it is a layout overwrite, please check and if there is one, tell here, so that I can add it to the "latest release notes"

here .... I'm interested in that ..... if the price is <0 then ask me the price, if the price is = 0 no, is it possible?thanks
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 21, 2012, 20:43:26 PM
I opened ticket on http://extensions.virtuemart.net  :'( :'(
Title: Re: Custom field do not display when product price is 0?
Post by: Grisu74 on December 27, 2012, 21:47:18 PM
This still does not make Virtuemart, price from 0, but if childbirth also 1 penny all goes well, I hope that in the next update be provided for this. thanks



[attachment cleanup by admin]