Jump to content

access $cart in OrderController to switch on/off address


Prestachopo

Recommended Posts

I have a virtual shop, with many articles, ok, some articles have a feature boolean that explain that the article can deliver to customer home or not (to deliver in my real shop to), ok, in the order process (OrderController.php) I want to change the switch to check if some article need to be delivery in my real shop (with a foreach and check self::$cart->_products for any 'feature' that make the article to be delivery to my real shop) if any article have the boolean feature to true I need to change the customer option to disable customer to specific a address, because if any of the articles need to deliver to my real shop I want to make others too.

   public function process()
   {
       parent::process();

       /* 4 steps to the order */
       switch ((int)$this->step)
       {
           case -1;
               self::$smarty->assign('empty', 1);
               break;
           case 1: // solicitud de direccion
               /***************************************************/
               echo '';
               var_dump(self::$cart); // dump all info of the customer cart, ok
               die;
               /***************************************************/
               /* future
               foreach (bla bla bla) {
                   // some cool and great stuff
               }
               if (count($products_home)) {
                   $this->_assignAddressAutomatic();
               }
               else {
                   $this->_assignAddress();
               }
               */
               break;
           case 2:
               if(Tools::isSubmit('processAddress'))
                   $this->processAddress();
               $this->autoStep();
               $this->_assignCarrier();
               break;
           case 3:
               // etc...



The problem:

If you put a var_dump to view self::$cart you can view that the '_products' array is a protected and can't access to this.

I try to access using parent:: Classname->$var and many methods more but nothing works for me.

Can anyone help me with this? I only need to retireve _products array in self::$cart Somebody know how I can do?

Thanks for all!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...