Jump to content

Passing varible to other controler


matzmu

Recommended Posts

Hello,

I want submit customization files with on "buy" click and i need to pass a $product from cart controler to Product controler . And i have question : i is a good aproach ? or it can be done better?

Genneral my solution works, but when user dont fill required textbox/file and error my theme broke.

when i comment 2 first error dont breake a theme.

 

that why i ask if is better aproach to pass product into other controler.

My code:

 

$product = new Product($this->id_product, true, $this->context->language->id);

Controller::getController('ProductController')->userContentUpload($product);

if (!$product->hasAllRequiredCustomizableFields() && !$this->customization_id)

$this->errors[] = Tools::displayError('Please fill in all of the required fields, and then save your customizations.');

 

theme with error and with my code :

 

http://imageshack.us...sd.jpg/%5C?sa=0

 

 

without 2 first line of code :

http://imageshack.us/photo/my-images/59/z6jz.jpg/

 

Thank you!

Edited by matzmu (see edit history)
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...