I have this issue with Prestashop 1.5.4 who uses the context object.
I'm creating a custom one page checkout with Ajax.
When the customers input is validated I insert this in the related database tables and receive the customer id. So when the customer changes some things I don't wanna insert it again but update his data. But I don't know how I can do with the context object.
I want something like this in my controller:
if (!$this->context->customer->id){
// there is no data of this customer, so insert it in the database
// set customer id context
}
else{
// there is data so update it
}
I tried a lot of things like:
$this->updateContext($customer);
$this->context->customer->id = (int)$customer->id;
$this->context->customer->update();
etc. etc.
Who can explain how I can update the context without refreshing the page?
Aucun commentaire:
Enregistrer un commentaire