virtuemart On check out

283 views Asked by At

I want to do a query to my product custom field when you press checkout

    function plgVmConfirmedOrder ($cart, $order) {


    $plugin = JPluginHelper::getPlugin('vmcustom', 'mi_plg');
    $pluginParams = new JRegistry();
    $pluginParams->loadString($plugin->params);



    $order_bt       = $order['items'];
    $user_id        = $order_bt->virtuemart_user_id;
    $order_number   = $order_bt->virtuemart_order_item_id;

    $db=JFactory::getDbo();

this foreach is when I get to enter the parameters I want //foreach ($atri as $key) {

        $q=$db->getQuery(true);

        $q->update('#__virtuemart_custom_plg_mi_plg_values');
        $q->set('state='.(int)$cero);
        $q->where('customsforall_value_id='.(int)$virtuemart_order_id);
        $db->setQuery($q);


            return false;
        }

    //}

    return true;


}

When you press checkout you delete the cart and the current prodcuts and its attributes i must to enter in the order but i cant. help my please

1

There are 1 answers

0
Jaac On

Hi I'll put the answer in case someone else needs it:

we need to add a private variable in the beginning of our class vmcustom plugin that variable and assign our array with our custom fields and then call that variable from our function

class plgVmCustomOurPlugin extends vmCustomPlugin {
   private $values_root;

    function plgVmOnViewCart(){

    $this->values_root = $values;
   }
   function plgVmConfirmedOrder{

    $values =  $this->values_root;


   }


}