Jump to content

Edit History

Chill_user

Chill_user

If I understood correctly, you need to just show some variables from db?

In your controller/module/some php file:

public static function getAddressCustom($id_customer){
$result = Db::getInstance()->getRow('
            SELECT *
            FROM `'._DB_PREFIX_.'address` sample
            WHERE sample.`id_customer` = '.(int)$id_customer
        );
}

Before to send the variables to the smarty, I recommend you to make all manipulations in php file, and after sent the proper data.Assign variable to the .tpl file, where 'customer_current_address' is your variable name in smarty

$this->context->smarty->assign('customer_current_address', $result);

P.S. check SQL queries here

P.S2: 

 You have power of "$this", for example :

//get customer cart id
$this->context->cart->id
//or changing delivery option to some custom id (dont run it like this)
$this->context->cart->setDeliveryOption(array($this->context->cart->id_address_delivery => $delivery_option));
$this->context->cart->save();

 

Chill_user

Chill_user

If I understood correctly, you need to just show some variables from db?

In your controller/module/some php file:

public static function getAddressCustom($id_customer){
$result = Db::getInstance()->getRow('
            SELECT *
            FROM `'._DB_PREFIX_.'address` sample
            WHERE sample.`id_customer` = '.(int)$id_customer
        );
}

Before to send the variables to the smarty, I recommend you to make all manipulations in php file, and after sent the proper data.

You have power of "$this", for example :

//get customer cart id
$this->context->cart->id
//or changing delivery option to some custom id (dont run it like this)
$this->context->cart->setDeliveryOption(array($this->context->cart->id_address_delivery => $delivery_option));
$this->context->cart->save();

Assign variable to the .tpl file, where 'customer_current_address' is your variable name in smarty

$this->context->smarty->assign('customer_current_address', $address);

P.S. check SQL queries here

×
×
  • Create New...