Jump to content

Append variables to already instantiated smarty array.


Recommended Posts

Guys, I have created a *.tpl file and I assigned some variables to the smarty array e.g:

public function hookExtraCarrier($params)
    {
            //deleted code...

            $this->context->smarty->assign(array(
                'wineo_free_shipping_id' => Configuration::get('WINEO_FREE_CARRIER_ID'),
                'this_path' => $this->_path,
                'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/',
            ));

        return $this->display(__FILE__, 'wineocarrier.tpl');
    }

I have another method that I want to add more variables to the array. I have tried things like:

  public function addCarrierNameList()
    {
      
        //deleted code...
        if (isset($carrierNameNorm)) {
          $this->context->smarty->assign(array(
            'wineo_shipping_type' => $carrierNameNorm['name']
          ));
        }
        // echo '<pre>', print_r($carrierNameNorm['name']),'</pre>';
        // return $this->display(__FILE__, 'wineocarrier.tpl');

      }
    }

I cannot get the 'wineo_shipping_type' variable in the template file.

 

What is the best way to approach this?

 

Thanks!!!

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...