简体   繁体   中英

virtuemart On check out

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

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;


   }


}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM