VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Products, Prices, Tax and Categories VM 1.1 => Topic started by: yakmosh on July 27, 2009, 16:50:57 pm

Title: Prices disappear
Post by: yakmosh on July 27, 2009, 16:50:57 pm
Whenever I edit a product description, the price often disappears and I have to reload it.  What am I doing wrong?   Thanks.
Title: Re: Prices disappear
Post by: iwankumara on September 07, 2009, 12:17:17 pm

To make price with more digit ;

Eg : US 19,900,900

Or to set the price function,

You have to change the product price table . It can be adjusted using “ PHP My Admin “ through your CPanel.

Step :
-   Go to Cpanel and login
-   Go to PHP Myadmin
-   Choose your databe on the upper left side, like “_jo151 “ or anything
-   Find Jos_VM_product_price on the left side
-   In Field structure, there is product price type decimal ( 12,5)
-   Edit this by click pencil icon, and change to ( 12,3)
-   Save
-   Now you can edit your price with more digit

Hope this help!

www.SinergiCyber.com
Your Web Developer Partner
Title: Re: Prices disappear
Post by: forwarddesign on September 24, 2009, 18:28:20 pm
This happens for me too!
Is threre someone out there who can help us!?

It´s really not fun to edit the produkts when the price disappear all the time
Title: Re: Prices disappear
Post by: TerraGuy on October 05, 2009, 02:41:04 am
I had this problem too. It has something to do with the 'vendor'. I removed all unused stuff from the backend by commenting html & php out, but that had the effect that prices would disappear. Another problem was that the edited products disappeared for other accounts (I had a special Joomla-account for editing/deleting/adding products).

When I looked in phpmyadmin at the record 'vm_products', I saw all the 'problem' products (ie. the ones I edited and had their prices removed) had a 0 in the vendor column, while the still correctly working (ie. unedited) had 1 in it. So I put the 'vendor' back (located in product.product_form.php), so when the database updates, it sets 'vendor' to '1' (or another, if you have several vendors).


Secondly, I ran an SQL-query to set all the products to have a 1 in the vendor column, and now it works again.

Hope this helps anyone. :)
Title: Re: Prices disappear
Post by: rhand-vm on March 11, 2010, 10:24:04 am

To make price with more digit ;

Eg : US 19,900,900

Or to set the price function,

You have to change the product price table . It can be adjusted using “ PHP My Admin “ through your CPanel.

Step :
-   Go to Cpanel and login
-   Go to PHP Myadmin
-   Choose your databe on the upper left side, like “_jo151 “ or anything
-   Find Jos_VM_product_price on the left side
-   In Field structure, there is product price type decimal ( 12,5)
-   Edit this by click pencil icon, and change to ( 12,3)
-   Save
-   Now you can edit your price with more digit

Hope this help!

www.SinergiCyber.com
Your Web Developer Partner


Might give this a shot. Changing the description makes prices disppear on my Virtuemart 1.1.4 under Joomla 1.5.15 every now and then as well and it is driving me nuts...
Title: Re: Prices disappear
Post by: stAn99 on April 20, 2010, 17:31:00 pm
Hello i described the solution here: http://forum.virtuemart.net/index.php?topic=64560.0;topicseen

The thing is that if you your vendor's id changes, than VM takes the first row in database, which is not default price for customers. It ignores 'default' column.
Title: Re: Prices disappear
Post by: rhand-vm on April 27, 2010, 07:42:39 am
So you suggest changing /administrator/components/com_virtuemart/html/product.product_form.php (path adjusted myself for my VM installation) around line 156 using
Code: [Select]
// get the default shopper group
$shopper_db = new ps_DB;
// stAn this 2 lines were added and sql modified
$vendor_id = $db->f("vendor_id");
if (!isset($vendor_id)) $vendor_id = 1;
$q =  "SELECT shopper_group_id,shopper_group_name FROM #__{vm}_shopper_group WHERE `default`= '1' AND vendor_id='".$vendor_id."'";
$shopper_db->query($q);

// stAn took me about 3 hours to find out

and that is caused by VM taking the first row in jos_vm_vendor (two vendors in my case)?

Someone else (VM Hero rb) mentioned (http://forum.virtuemart.net/index.php?topic=64560.msg233525#msg233525) Virtuemart only supports one vendor. I use VM 1.1.4. and this might be the problem as I have two at the moment. If this is the case VM should come up with patches as soon as possible. I am also checking if I can remove vendor id no 2 as we only need one vendor as far as I can see.
Title: Re: Prices disappear
Post by: rhand-vm on April 27, 2010, 10:20:32 am
Any VM Hero out here who could tell me what option is better and if Virtuemart has come with a patch already?
Title: Re: Prices disappear
Post by: rhand-vm on April 27, 2010, 12:10:14 pm
I just noticed VM's back office mentions only one Vendor under vendors, which has ID 2 and in PHPMyAdmin I see two vendors including Vendor with ID 1. And on a product edit page Vendor ID one does show up and as the first vendor in the vendor dropdown..
Title: Re: Prices disappear
Post by: rhand-vm on April 27, 2010, 13:09:35 pm
In http://forum.virtuemart.net/index.php?topic=43687.15 I read 1.1.2 would already be a multi vendor VM and I have 1.1.4. I guess that did not work out. And I do not really need multiple vendors now even though I'd say it should be an option. Now I just need a way to make vendor ID 1 show in the back office and remove ID 2 if need be to make sure no prices disappear anymore.
Title: Re: Prices disappear
Post by: shv_rk on April 27, 2010, 13:31:01 pm
Multiple vendors are essential for my website!

if the VM does not support multiple vendors it should be removed from the options. I have bought a module just because it has vendor search option!!!

Any solutions?
Title: Re: Prices disappear
Post by: rhand-vm on April 28, 2010, 08:21:34 am
Any news yet anyone?
Title: Re: Prices disappear
Post by: rhand-vm on April 29, 2010, 07:36:53 am
Well I removed vendor 2 now. Will see if that solved the issue of prices being removed. Too bad I did not get any useful replies on this forum so far besides the comments already made. I'd say this is a serious issue after all.
Title: Re: Prices disappear
Post by: rhand-vm on May 02, 2010, 11:42:42 am
Well, removing vendor two does not seem to solve the price disappearing issue. When I save the new product from a second tab such as "Product Dimensions and Weight" the price is not stored. It is deleted just like that. When I am on the main or initial tab with "Product Information" and add all fields with text i a separate custom box the latest and click apply the price is removed as well. Basically clicking apply after adding some data to a product fields seems to remove the price all the time. Saving seems to do a better job.
Other odity, when we removed vendor two in PHPMyAdmin Vendor one did not show up in the vendor list even though it did show up as the only choice in the product information tab..
Title: Re: Prices disappear
Post by: rhand-vm on May 02, 2010, 12:12:59 pm
Well when I did a test on the local server and filled in fields with the price field before three others and clicked save the price disappeared and I got this PHP warning (Local PHP error settings are stricter then on the live server):
Product Price (Net):
Warning: number_format() expects parameter 1 to be double, string given in /opt/local/apache2/htdocs/joomla/administrator/components/com_virtuemart/classes/currency/class_currency_display.php on line 116

That line has
Code: [Select]
$res=number_format($nb,$decimals,$this->decimal,$this->thousands);
Just clicking apply after adding data removed the price again, but I did not see a PHP error. I did turn on debugging and I'd say the clues are somewhere here:
Code: [Select]
#
WHERE product_id=485
  AND vendor_id=1
#
UPDATE jos_vm_product_mf_xref
  SET manufacturer_id=2
  WHERE product_id = 485
#
SELECT `category_id`
  FROM `jos_vm_product_category_xref`
  WHERE `product_id` = '485'
#
DELETE
  FROM jos_vm_product_relations
  WHERE product_id='485'
#
SELECT product_price_id, price_quantity_start, price_quantity_end
  FROM jos_vm_product_price
  WHERE shopper_group_id=5
  AND product_id = 485
#
SELECT count(*) AS num_rows
  FROM jos_vm_product_price
  WHERE shopper_group_id = '5'
  AND product_id = '485'
  AND product_currency = 'EUR'
  AND (('0' >= price_quantity_start
  AND '0' <= price_quantity_end) OR ('0' >= price_quantity_start
  AND '0' <= price_quantity_end))
#
INSERT INTO `jos_vm_product_price` (`product_id`,
`shopper_group_id`,
`product_price`,
`product_currency`,
`product_price_vdate`,
`product_price_edate`,
`cdate`,
`mdate`,
`price_quantity_start`,
`price_quantity_end`)
  VALUES (
'485'
,'5'
,'300'
,'EUR'
,''
,''
,'1272798149'
,'1272798149'
,'0'
,'0'
)
#
SELECT `product_type_id`
  FROM `jos_vm_product_product_type_xref`
  WHERE `product_id`=485
#
SELECT `product_id`
  FROM `jos_vm_product_attribute_sku`
  WHERE `product_id`=485
#
SELECT module_name,module_perms
  FROM jos_vm_module
  WHERE module_publish='Y'
  AND module_name <> 'checkout'
  ORDER BY list_order ASC
#
SELECT `product_id`
  FROM `jos_vm_product_attribute_sku`
  WHERE `product_id`=485
#
SELECT vendor_id
  FROM jos_vm_product
  WHERE product_id='485'
#
SELECT shopper_group_id
  FROM jos_vm_shopper_group
  WHERE `vendor_id`='1'
  AND `default`='1'
#
SELECT product_price,product_currency,price_quantity_start,price_quantity_end
                               
  FROM jos_vm_product_price
                               
  WHERE product_id='485'
  AND
                                                        shopper_group_id='5'

Title: Re: Prices disappear
Post by: rhand-vm on May 02, 2010, 14:53:14 pm
I addded a new product and price 12.345 an got a 500 Internal Server Error showing:

JDatabaseMySQL::query: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 SQL=SELECT MAX(`product_list`) as list_order FROM `jos_vm_product_category_xref` WHERE `category_id`=

Call stack
#    Function    Location
1    JAdministrator->dispatch()    /opt/local/apache2/htdocs/joomla/administrator/index.php:67
2    JComponentHelper->renderComponent()    /opt/local/apache2/htdocs/joomla/administrator/includes/application.php:136
3    require_once()    /opt/local/apache2/htdocs/joomla/libraries/joomla/application/component/helper.php:162
4    require_once()    /opt/local/apache2/htdocs/joomla/administrator/components/com_virtuemart/admin.virtuemart.php:29
5    vm_ps_product->add()    /opt/local/apache2/htdocs/joomla/components/com_virtuemart/virtuemart_parser.php:246
6    vm_ps_DB->query()    /opt/local/apache2/htdocs/joomla/administrator/components/com_virtuemart/classes/ps_product.php:348
7    JDatabaseMySQL->loadObjectList()    /opt/local/apache2/htdocs/joomla/administrator/components/com_virtuemart/classes/ps_database.php:120
8    JDatabaseMySQL->query()    /opt/local/apache2/htdocs/joomla/libraries/joomla/database/database/mysql.php:458
9    JError->raiseError()    /opt/local/apache2/htdocs/joomla/libraries/joomla/database/database/mysql.php:231
10    JError->raise()    /opt/local/apache2/htdocs/joomla/libraries/joomla/error/error.php:171
11    JException->__construct()    /opt/local/apache2/htdocs/joomla/libraries/joomla/error/error.php:136

Apparently the query could not handle the price 12.345 nor 12,345 . But it somehow does store the product SKU and title, but does not show this data nor does it show the entered price.
Title: Re: Prices disappear
Post by: rhand-vm on May 02, 2010, 15:33:38 pm
When I store a price and it is not displayed again (12.34) when creating a document for the first time it IS stored in the database (checked using PMA). So maybe the new price, is just not retrieved properly after insertion. But on a second time clicking apply the price is shown so I'd say display works on update, but not after the first insertion. Here is all debug data after first insertion when price is not displayed but is stored in the database
Code: [Select]
#
)
#
SELECT MAX(`product_list`) AS list_order
  FROM `jos_vm_product_category_xref`
  WHERE `category_id`=11
#
INSERT INTO jos_vm_product_category_xref (category_id,product_id,product_list)
  VALUES ('11','496', 1)
#
INSERT INTO jos_vm_product_mf_xref
  VALUES ('496', '2')
#
SELECT count(*) AS num_rows
  FROM jos_vm_product_price
  WHERE shopper_group_id = '8'
  AND product_id = '496'
  AND product_currency = 'EUR'
  AND (('0' >= price_quantity_start
  AND '0' <= price_quantity_end) OR ('0' >= price_quantity_start
  AND '0' <= price_quantity_end))
#
INSERT INTO `jos_vm_product_price` (`product_id`,
`shopper_group_id`,
`product_price`,
`product_currency`,
`product_price_vdate`,
`product_price_edate`,
`cdate`,
`mdate`,
`price_quantity_start`,
`price_quantity_end`)
  VALUES (
'496'
,'8'
,'12'
,'EUR'
,''
,''
,'1272808823'
,'1272808823'
,'0'
,'0'
)
#
SELECT `product_id`
  FROM `jos_vm_product_attribute_sku`
  WHERE `product_id`=496
#
SELECT module_name,module_perms
  FROM jos_vm_module
  WHERE module_publish='Y'
  AND module_name <> 'checkout'
  ORDER BY list_order ASC
#
SELECT `product_id`
  FROM `jos_vm_product_attribute_sku`
  WHERE `product_id`=496
#
SELECT vendor_id
  FROM jos_vm_product
  WHERE product_id='496'
#
SELECT shopper_group_id
  FROM jos_vm_shopper_group
  WHERE `vendor_id`='1'
  AND `default`='1'
#
SELECT product_price,product_currency,price_quantity_start,price_quantity_end
                               
  FROM jos_vm_product_price
                               
  WHERE product_id='496'
  AND
                                                        shopper_group_id='5'
#
SELECT *
  FROM `jos_vm_product`
  WHERE `product_id`=496
#
SELECT product_id, `jos_vm_product`.*
  FROM `jos_vm_product`
  WHERE `product_id`=496
#
SELECT product_id, `jos_vm_product`.*
  FROM `jos_vm_product`
  WHERE `product_id`=496
#
SELECT category_id
  FROM jos_vm_product_category_xref
  WHERE product_id='496'
#
SELECT manufacturer_id
  FROM jos_vm_product_mf_xref
  WHERE product_id='496'
#
SELECT related_products
  FROM jos_vm_product_relations
  WHERE product_id='496'
#
SELECT shopper_group_id,shopper_group_name
  FROM jos_vm_shopper_group
  WHERE `default`= '1'
  AND vendor_id='1'

I see that shpping_group_id 8 is given on first storage and 5 on update so maybe that is the culprit..
Title: Re: Prices disappear
Post by: rhand-vm on May 02, 2010, 21:00:24 pm
This is the shopper group table content I have currently:

INSERT INTO `jos_vm_shopper_group` (`shopper_group_id`, `vendor_id`, `shopper_group_name`, `shopper_group_desc`, `shopper_group_discount`, `show_price_including_tax`, `default`) VALUES
(5, 1, '-default-', 'This is the default shopper group.', 0.00, 1, 1),
(6, 1, 'Gold Level', 'Gold Level Shoppers.', 0.00, 1, 0),
(7, 1, 'Wholesale', 'Shoppers that can buy at wholesale.', 0.00, 0, 0),
(8, 0, '-default-', 'Our shop', 0.00, 1, 1);

Two times default as shopper_groups_name should not really be the issue (even though default can only be chosen as group once), but one shopper having vendor ID 0 connected to it might be an issue. And then there is the strange business of the usage of two shopper groups IDs for storage and display of prices when the price is added to the database for the first time. I think that there are two default groups and in the second half of the process query looks for shopper group with vendor ID 1 and one that is default. Then you get shopper group 5. The fact that shopper group 5 and 8 are both default (not just as a group name) is not good..
Title: Re: Prices disappear
Post by: shv_rk on May 11, 2010, 12:50:47 pm
so, having more than 1 vendor is still is not an option?
Title: Re: Prices disappear
Post by: rhand-vm on May 18, 2010, 10:55:38 am
No it is not an option yet as far as I know. Another issue I had was creating two default shopper groups. Had to remove one as well.
Title: Re: Prices disappear
Post by: stAn99 on May 24, 2010, 15:13:00 pm
So you suggest changing /administrator/components/com_virtuemart/html/product.product_form.php (path adjusted myself for my VM installation) around line 156 using
Code: [Select]
// get the default shopper group
$shopper_db = new ps_DB;
// stAn this 2 lines were added and sql modified
$vendor_id = $db->f("vendor_id");
if (!isset($vendor_id)) $vendor_id = 1;
$q =  "SELECT shopper_group_id,shopper_group_name FROM #__{vm}_shopper_group WHERE `default`= '1' AND vendor_id='".$vendor_id."'";
$shopper_db->query($q);

// stAn took me about 3 hours to find out

and that is caused by VM taking the first row in jos_vm_vendor (two vendors in my case)?

Someone else (VM Hero rb) mentioned (http://forum.virtuemart.net/index.php?topic=64560.msg233525#msg233525) Virtuemart only supports one vendor. I use VM 1.1.4. and this might be the problem as I have two at the moment. If this is the case VM should come up with patches as soon as possible. I am also checking if I can remove vendor id no 2 as we only need one vendor as far as I can see.
No, the problem is not in jos_vm_vendor, but in jos_vm_shopper_group, because VM takes first row! (which can be for example whole sale price and that's the reason why prices disappear) Therefore you have to modify VM to set the default retail price and not any other defined prices. When you save the product and you think, that your prices has disappeared, just click on price in administration of product and you will see that price is there, but not as default (retail, visible). I cannot imagine, how could somebody rely on taking a first row of a table...