Post by uebz » Wed Sep 19, 2018 6:13 pm

OpenCart 3.0.2

Anyone know what this code does?

if( isset( $this->request->post['sku'] ) )
{
$data['sku'] = $this->request->post['sku'];
}
elseif( !empty( $product_info ) )
{
$data['sku'] = $product_info['sku'];
}
else
{
$data['sku'] = '';
}

ControllerCatalogProduct class's getForm method

1. getForm() only gets called on editing a product and adding a product?
2. elseif gets executed on edit if there is data or no data in the sku field
3. else gets executed on add

so the question is when does the if() or $data['sku'] = $this->request->post['sku']; get executed???

Newbie

Posts

Joined
Sat Sep 01, 2018 1:44 pm

Post by straightlight » Wed Sep 19, 2018 6:16 pm

When saving the form from the OC admin catalog products page.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by uksitebuilder » Sat Sep 22, 2018 2:02 pm

That gets called when product is loaded/selected from list of products in admin.

1. is called when product form is submitted and either has new product data submitted or editing existing product data is submitted
2. gets called when when product is loaded after clicking edit in the list of products
3. gets called when add new product button is pressed and form is empty waiting for you to enter data

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom
Who is online

Users browsing this forum: No registered users and 220 guests