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

MultiVariant products price with missing price fields

Started by razor7, October 10, 2017, 00:55:09 AM

Previous topic - Next topic

razor7

Hi! I realized that if I create a multi variant product and set the price for the child products from the parent the price created in the virtuemart_product_prices table get some missing fields, that affects the product price model, so something like this productPriceTable->check() will fail to check!

Example:
If I go to product id 3624 and create one multivariant level and add a product (id 3625), the price gets saved to DB with this data
INSERT INTO `i1rl3_virtuemart_product_prices` (`virtuemart_product_price_id`, `virtuemart_product_id`, `virtuemart_shoppergroup_id`, `product_price`, `override`, `product_override_price`, `product_tax_id`, `product_discount_id`, `product_currency`, `product_price_publish_up`, `product_price_publish_down`, `price_quantity_start`, `price_quantity_end`, `created_on`, `created_by`, `modified_on`, `modified_by`, `locked_on`, `locked_by`) VALUES
(3668, 3625, 0, '203.000000', NULL, NULL, NULL, NULL, NULL, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, '2017-10-09 22:44:48', 927, '2017-10-09 22:44:48', 927, '0000-00-00 00:00:00', 0);


If I go to child product 3625 and just save the product (no changes at all), I get this in the price table
INSERT INTO `i1rl3_virtuemart_product_prices` (`virtuemart_product_price_id`, `virtuemart_product_id`, `virtuemart_shoppergroup_id`, `product_price`, `override`, `product_override_price`, `product_tax_id`, `product_discount_id`, `product_currency`, `product_price_publish_up`, `product_price_publish_down`, `price_quantity_start`, `price_quantity_end`, `created_on`, `created_by`, `modified_on`, `modified_by`, `locked_on`, `locked_by`) VALUES
(3668, 3625, 0, '203.000000', 0, '0.00000', 0, 0, 7, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, '2017-10-09 22:44:48', 927, '2017-10-09 22:46:11', 927, '0000-00-00 00:00:00', 0);


As you can see, price generated from parent save gets missing some price fields, and makes price model check() funcion to fail, because it will run a query like this:

SELECT `virtuemart_product_price_id`
FROM `#__virtuemart_product_prices`
WHERE `virtuemart_product_id` = 3624 AND (`price_quantity_start` = 0 OR `price_quantity_start` IS NULL) AND (`price_quantity_end` = 0 OR `price_quantity_end` IS NULL) AND `virtuemart_shoppergroup_id` = 0 AND `product_currency` = 7 AND `product_price_publish_up` = '0000-00-00 00:00:00' AND `product_price_publish_down` = '0000-00-00 00:00:00'


This wil fail because parent save missed to copy the product_currency to childs price.

J 3.8.1
VM 3.2.4
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store