News:

Support the VirtueMart project and become a member

Main Menu

custom field plugin + access to $product price, VM3

Started by Adwans, April 02, 2016, 20:06:09 PM

Previous topic - Next topic

Adwans

Hello,
I dug the Forum but with no success... Also learned from "Code adjustments" and Reinhold's manual (thanks a lot)
So:
I developed textinput Custom field plugin, a bit. Adding a new radio input. Everything is ok, so far so good.
BUT NOW:
in function
public function plgVmPrepareCartProduct(&$product, &$customfield,$selected,&$modificatorSum)
CANNOT get any product price from here?
How could I do it properly?
$product->allPrices[0]['HERE_PRICE_NAME'] ?
or: $product->prices['HERE_PRICE_NAME']? Or any other way?
Courious, with no problem I get in plgVmPrepareCartProduct function:
$product->virtuemart_product_name;
PS> Maybe it is due to VM2->VM3 upgrade done before, and something with database tables is wrong?

kishoreonwork

Hello,

It may too late, But you can do a var_dump of $product->allPrices[0]; Like, i have done it see below. You will be able to see the data in it . But you will be much interested in the price  which is in this array - $product->allPrices[0]['product_price']


array(1) {
  [0]=>
  array(19) {
    ["virtuemart_product_price_id"]=>
    string(4) "9085"
    ["virtuemart_product_id"]=>
    string(4) "1332"
    ["virtuemart_shoppergroup_id"]=>
    string(1) "0"
    ["product_price"]=>
    string(9) "24.000000"
    ["override"]=>
    string(1) "0"
    ["product_override_price"]=>
    string(7) "0.00000"
    ["product_tax_id"]=>
    string(1) "0"
    ["product_discount_id"]=>
    string(1) "0"
    ["product_currency"]=>
    string(2) "47"
    ["product_price_publish_up"]=>
    string(19) "0000-00-00 00:00:00"
    ["product_price_publish_down"]=>
    string(19) "0000-00-00 00:00:00"
    ["price_quantity_start"]=>
    string(1) "0"
    ["price_quantity_end"]=>
    string(1) "0"
    ["created_on"]=>
    string(19) "2018-06-14 16:39:34"
    ["created_by"]=>
    string(1) "1"
    ["modified_on"]=>
    string(19) "2018-06-27 15:02:06"
    ["modified_by"]=>
    string(3) "197"
    ["locked_on"]=>
    string(19) "0000-00-00 00:00:00"
    ["locked_by"]=>
    string(1) "0"
  }
}


Thanks
Kishore
I am available for paid joomla and virtuemart consulting.
http://www.kishoreweblabs.com/
skype kishore2607

Studio 42

@kishoreonwork, can you please stop to answer to old threads, it disturbs other users