Author Topic: Price gets deleted???  (Read 11957 times)

jbomb

  • Beginner
  • *
  • Posts: 16
Price gets deleted???
« on: June 25, 2009, 20:26:00 pm »
For some reason the product price just disappears when I enter in a short description and save.  I'm guessing that's not supposed to happen.

Also I'm a bit confused.  When I list products, and enter in Product Price (Net) and Product Price (Gross) and save it works, but when I go back to the product page, the amount doesn't stay in those fields.  Are they supposed to stay there?

MikeDivine

  • Beginner
  • *
  • Posts: 49
Re: Price gets deleted???
« Reply #1 on: June 26, 2009, 04:01:44 am »
Yes I am having this same issue, I have joomla 1.5x and had virtuemart 1.1.2 and I was having the issue then and updated to virtuemart 1.1.3 and it is still happening so I guess the issue wasn't addressed in the update. Here is my take on this issue.

I go to add a product and put in the SKU, Name, Description and price. I then click save or apply, I've tried both and they neither save the price and then I go back to the product under product list and see it is set at 0.00 so I go back into it and reset it and then it saves but if I go to the product again the price fields will be empty.

I am going to go look in the files to see if I can find the issue, a lot of files though so we will see if I can find it. If I do I will update this post or hopefully somebody will figure this out sooner.

DeeCee

  • Jr. Member
  • **
  • Posts: 177
Re: Price gets deleted???
« Reply #2 on: June 26, 2009, 05:20:10 am »
Check that you can write to the database. First time I had this problem was because I couldn't write to the server.
I take no responsibility for any lost work. It is your responsibility to back up files before attempting anything I suggest as I may be:
a) intoxicated
b) high on sugar
c) can't concentrate due to lack of sleep

If you like my hacks, feel free to buy me a coffee, muffin or both :)

paypal: deecee23 at gmail dot com

Hacks in progress: Manufacturer Logo Hack - 100% done

MikeDivine

  • Beginner
  • *
  • Posts: 49
Re: Price gets deleted???
« Reply #3 on: June 26, 2009, 06:21:32 am »
Yes it can write to the database because everything else is being written to the database just not the price sometimes. I looked into the file product.product_form.php which is the file being used to add products and edit products. The following if statement is used:

if (!empty($product_id)) {
   $price = $ps_product->get_retail_price($product_id);
} else {
   $price['product_price'] = vmGet($_REQUEST,'product_price', '');
}

When I tried to echo $price after this statement the output was array so i used count($price) to find the length of the array and  the length was 4. So I tried to echo $price[0] through $price[3] and nothing is stored.

$ps_product is an object instance that is not pulling the price correctly.

Maybe I should just overwrite the if statement to just pull the price directly from the database? What do you think DeeCee?

webwahoo

  • Beginner
  • *
  • Posts: 4
Re: Price gets deleted???
« Reply #4 on: June 26, 2009, 06:32:08 am »
Exact same problem for me....anyone figure it out yet?

jbomb

  • Beginner
  • *
  • Posts: 16
Re: Price gets deleted???
« Reply #5 on: June 26, 2009, 13:54:44 pm »
Wow, I'm not the only one having this issue.
Yeah, the price does work sometimes.  For instance, if I type it in the first screen.  it saves.  If I do it from the list, it saves.  If I do it from the list prices it saves.

but I do not see it again when  I go back to the product detail I never see the price in the Product Price (Net) or Product Price (Gross)fields.  and like I said, just adding or changing something in the short description field erased the data.

I'm on Joomla 1.5.9 using Virtuemart 1.1.3 on a godaddy account.

DeeCee

  • Jr. Member
  • **
  • Posts: 177
Re: Price gets deleted???
« Reply #6 on: June 26, 2009, 14:12:11 pm »
I was working with Mike on this earlier in the evening (well here in NZ that is, he went to sleep and I'm working on a coupon discount thingamajig).

Things Mike and I discussed:
1) I don't have an issue with updating pricing on my local server @ home.
2) Mike is also on the GoDaddy host.
3) If this issue was a fundamental code issue, then others would have problems and I would expect that the devs would have addressed the issue immediately.

If you use the extended layout, the prices will update. I have tested that on Mike's proto site.

My thoughts on this are that the issue is related to:
1) the GoDaddy host
2) the java button that calls the save function in the menuBar.class.php.

Note, there is an issue with the image save button under image upload, so maybe directly related.

That is as far as I got as Mike and I were going through various files trying to pinpoint what is happening and how to resolve and I had to get onto this coupon discount thing which is a priority for me.

Jbomb - if you can get the save button to work intermittantly then I would direction my attention to the GoDaddy host. It was one of the main thigns on my mind as the GoDaddy host is so slow to load anything here in NZ.

Of note, I did debug and the values are being passed to the database. I have copies of the debug outputs.

Maybe because GoDaddy space is shared, there are issues passing data to the databases.
I take no responsibility for any lost work. It is your responsibility to back up files before attempting anything I suggest as I may be:
a) intoxicated
b) high on sugar
c) can't concentrate due to lack of sleep

If you like my hacks, feel free to buy me a coffee, muffin or both :)

paypal: deecee23 at gmail dot com

Hacks in progress: Manufacturer Logo Hack - 100% done

jbomb

  • Beginner
  • *
  • Posts: 16
Re: Price gets deleted???
« Reply #7 on: June 26, 2009, 14:27:16 pm »
well, I tried the extended layout.  Nope.  Same issue. A. it deletes the price when I changed the short description.  And I still don't see the price in the Product Price (Net) and the Product Price (Gross) fields on the product update page.  Godaddy isn't as slow here.

I also have this issue with the images.  I have the large and thumbnail image, but the large doesn't show up on the product page, only in the zoom.

DeeCee

  • Jr. Member
  • **
  • Posts: 177
Re: Price gets deleted???
« Reply #8 on: June 26, 2009, 15:16:50 pm »
When I was playing around on Mike's site, the pricing would update once the main product ID + other info was entered into the database ie the file created, then the pricing set as required, either in the main products list window or in product detail. It would also work for clone.

For some reason, it wouldn't save when entering a brand new product though.

The save button works for clone and modifying a set product, so I don't believe it is the save function (though there are some doubts about it) as the save function is independant from the product.product_form.php.

As for the image, its suppose to be a thumb image on the product details page, not a full image unless you set the flypage template to show the full image. But then that defeats the function of the lightbox.

I'm of the mind that its a GoDaddy issue. I can't confirm or deny until Mike wakes up again and gets me back on so I can try his site on my local server.
I take no responsibility for any lost work. It is your responsibility to back up files before attempting anything I suggest as I may be:
a) intoxicated
b) high on sugar
c) can't concentrate due to lack of sleep

If you like my hacks, feel free to buy me a coffee, muffin or both :)

paypal: deecee23 at gmail dot com

Hacks in progress: Manufacturer Logo Hack - 100% done

MikeDivine

  • Beginner
  • *
  • Posts: 49
OK Breakthrough!!
« Reply #9 on: June 27, 2009, 06:11:52 am »
OK so I found out the issue. When you goto add the product it is adding as the current vendor shopper group. Then when it pulls the product list it is pulling the price from the default vendor shopper group. Usually this would be the same unless you added a new vendor because you didn't want it to be Washipitos or whatever that was. Then when you edited the product it would enter the duplicate product price but with the current vendor shopper group so it would now show the price, but then every time you would goto edit the price it would pull from the default vendor shopper group so hence it would show blank.

It had 2 default shopper groups and wouldn't let me delete either of them.
To fix it I deleted the default vendor shopper group and made my current default the only default. I had to go into the database as it wouldn't let me do it from within the admin area. It might be easier to just delete all the vendor groups but the default. So I guess messing with the shopper groups and vendors was a mistake because my site still kept looking for the old default shopper group and I just changed the variable to always be my current default shopper group. So I still have to figure out how I'm gonna fix that. But I figured out why it was being screwy.

But I don't think you will have the problem if you leave the washipitos default and delete your new one.

jbomb

  • Beginner
  • *
  • Posts: 16
Re: Price gets deleted???
« Reply #10 on: June 30, 2009, 14:57:40 pm »
Eeerrg.... I posted a reply and it didn't seem to work.  This still doesn't solve the issue. 


Question.  When you go back into a product, should the price show up in the fields????   Product Price (Net): and Product Price (Gross):


as it stands they are blank.  So I'm guessing that when I make any update, it deletes the price when I update unless I put the price in again, which I believe shouldn't happen.  Please please please answer this question.  is the price supposed to show up???????

if so any ideas on how to fix it????

giwrgos_ath

  • Beginner
  • *
  • Posts: 3
Re: Price gets deleted???
« Reply #11 on: September 03, 2009, 15:36:19 pm »
I recently upgraded joomla (from 1.5.9 to 1.5.14) and virtuemart (from 1.1.2 to 1.1.3) and came across the same issue.

since i know a little bit of php i tried to solve it and i found a simple solution.

First of all, i shall note that the prices are still stored in the database, but the page cannot fetch them. If you don't fill the correct price before you press "save" to update the item, the price will be overwritten and it will then become null.

This means that if you don't care to update any items or if you don't mind typing the price again, you don't need to change anything.

Ok so my solution is as following...

1. Locate the file product.product_form.php in the directory administrator/components/com_virtuemart/html

2. Open it.

3. Locate the following
Code: [Select]
<input type="text" value="<?php echo @$price["product_price"]; ?>" class="inputbox" name="product_price" onkeyup="updateGross();" size="10" maxlength="10" /> which should be around line 301

4. Replace that line with the following
Code: [Select]
<?php
/************| MOD BY LAGO BEGINS |************/
// Get category IDs
$myDB = new ps_DB;
$myQuery "SELECT * FROM #__{vm}_product_price WHERE product_id='$product_id'";
$myDB->query($myQuery);
$myDB->next_record();
$myPrice $myDB->f("product_price");
?>

<input type="text" value="<?php echo $myPrice?>" class="inputbox" name="product_price" onkeyup="updateGross();" size="10" maxlength="10" />
(feel free to remove my comments :P)

5. Save the file (and upload it).

6. That's all. You're done!

I have another site with Joomla v1.5.9 and VM v1.1.3 and the prices work fine.

From my understanding the problem is that Joomla made some changes in the code that VirtueMart uses to fetch the prices, and VM needs to publish an update to fix that issue.

My fix simply fetches the price of the item, and then inserts it in the correct field (Product Price (Net)). The other fields (Product Price (Gross)) are filled automatically.

I hope the above can help you :)

Just a note: using the above fix, when you press save to update the item, you will still see 0.00 as a Product Price (Net) on the next page (Item Update Results), but that is not a problem. The price will be saved/updated properly.

Let me know if you have any problems with the above code, and remember to "stay on the safe side" and keep backups...


btw, if anyone cares to look the problem a bit more, then you can locate the following line in the same file
Code: [Select]
$price = $ps_product->get_retail_price($product_id);
the problem is with the function it uses there. if you
Code: [Select]
print_r($price);
you will see that it will return no values. :)

Jroseland

  • Beginner
  • *
  • Posts: 11
Re: Price gets deleted???
« Reply #12 on: March 11, 2010, 01:10:07 am »
I am running Joomla 1.5.15 & VirtueMart 1.1.4 stable

I am about to punch a hole in my computer screen (or a VirtueMart Developer if I could find one) because of this issue.

Like these other people my prices are not displaying on my front end after I type them into the back end VM content management system. I've turned off the setting to auto calculate taxes in, I'm not doing any weird buyer groups, I'm not using GoDaddy hosting. VirtueMart is just refusing to display my prices on the front end of the site.

I tried inserting giwrgos_ath's php script into the product.product_form.php file. That makes no difference.

What has me dumbfounded further is that, when I pull up items in the backend VM CMS they have their correct price showing. So obviously their price is being by the database but it is not populating in the front end for some god damned reason

Hopefully someone out there can help me...

jacao

  • Beginner
  • *
  • Posts: 1
Re: Price gets deleted???
« Reply #13 on: July 21, 2010, 16:33:19 pm »
My fix simply fetches the price of the item, and then inserts it in the correct field (Product Price (Net)). The other fields (Product Price (Gross)) are filled automatically.

Thank you! Thank you! Thank you!

I read many topics (about 8 hours!) to find soloution for "deleting the price when editing product". Your hack works for me fine. Now the prices are shown at fileds when I'm going to edit the product properties.

Regards! j.

kleinbaas

  • Beginner
  • *
  • Posts: 34
Re: Price gets deleted???
« Reply #14 on: April 16, 2013, 15:35:12 pm »
SOLVED: You can fix this problem by correcting the vendor_id for the shopper_group in the database.
When you create a new vendor, the default shopper group for that vendor is created automatically, but the vendor_id used is always 1 (in my case), not the new vendor's id.
Edit the table using phpMyAdmin and set the vendor_id to the correct number (i.e. 2). The product price will no longer be shown as blank in the Update Item page and will no longer be deleted when you click on Save or Apply. Everything will work as normal.
If you want to thank me, please buy something small from http://www.bannerfieldtools.com.