Post by dun7ill » Mon Aug 06, 2018 5:04 pm

Dear All,

I need to show product MPN at order page in admin panel.
I did this in version 2.3.0.2
But now I've try on 3.0.2.0 but I can't make it.
Could anyone help me ti make it ?

Regards,

New member

Posts

Joined
Mon Nov 06, 2017 5:15 am

Post by straightlight » Mon Aug 06, 2018 7:43 pm

I did this in version 2.3.0.2
Source? Forum rules.

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

User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by straightlight » Mon Aug 06, 2018 7:48 pm

This extension is for the SKU. However, the request is about the MPN.

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 xxvirusxx » Mon Aug 06, 2018 7:51 pm

As I said....it easy to change for MPN...

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by straightlight » Mon Aug 06, 2018 8:13 pm

It is quite easy to change, indeed. In admin/controller/sale/order.php file,

find all instances of:

Code: Select all

foreach ($products as $product) {
add above each:

Code: Select all

$this->load->model('catalog/product');
Then, below each instances of:

Code: Select all

foreach ($products as $product) {
add below each:

Code: Select all

$product_info = $this->model_catalog_product->getProduct($product['product_id']);
Then, find all instances of:

Code: Select all

'model'      => $product['model'],
add below each:

Code: Select all

'mpn'     => $product_info['mpn'],
Then, in your admin/language/en-gb/sale/order_form.php file,

find:

Code: Select all

$_['column_model']               = 'Model';
add below:

Code: Select all

$_['column_mpn'] = 'MPN';
Then, in your admin/view/template/sale/order_form.twig file,

find:

Code: Select all

<td class="text-left">{{ column_model }}</td>
add below:

Code: Select all

<td class="text-left">{{ column_mpn }}</td>
Then, find:

Code: Select all

<td class="text-left">{{ order_product.mpn }}</td>

Then, find:

Code: Select all

<td class="text-center" colspan="X">{{ text_no_results }}</td>
Increment the X value that you see by 1.

In catalog/controller/api/order.php file,

find all instances of:

Code: Select all

foreach ($this->cart->getProducts() as $product) {
add above each:

Code: Select all

$this->load->model('catalog/product');
Then, below all instances of:

Code: Select all

foreach ($this->cart->getProducts() as $product) {
$product_info = $this->model_catalog_product->getProduct($product['product_id']);

Then, find all instances of:

Code: Select all

'model'      => $product['model'],
add below each:

Code: Select all

'mpn'   => $product['mpn'],
Then, in catalog/controller/mail/order.php file,

find:

Code: Select all

$data['text_model'] = $language->get('text_model');
add below:

Code: Select all

$data['text_mpn'] = $language->get('text_mpn');
Then, find all instances of:

Code: Select all

foreach ($order_products as $order_product) {
add above each:

Code: Select all

$this->load->model('catalog/product');
Then, below all instances of:

Code: Select all

foreach ($order_products as $order_product) {
add:

Code: Select all

$product_info = $this->model_catalog_product->getProduct($order_product['product_id']);
Then, find all instances of:

Code: Select all

'model'    => $order_product['model'],
add below each:

Code: Select all

'mpn'   => $product_info['mpn'],
Then, in catalog/language/en-gb/mail/order_add.php file,

find:

Code: Select all

$_['text_model']            = 'Model';
add below:

Code: Select all

$_['text_mpn']               = 'MPN';
In catalog/view/theme/<your_theme>/template/mail/order_add , edit and alert.twig file (if applied),

find all instances of:

Code: Select all

<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">{{ text_model }}</td>
add below each:

Code: Select all

<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">{{ text_mpn }}</td>
Then, still on each of these TWIG files, find (if applied):

Code: Select all

<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">{{ product.model }}</td>
add below each:

Code: Select all

<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">{{ product.mpn }}</td>
This should resolved the issue.

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 xxvirusxx » Tue Aug 07, 2018 12:38 am

Depends on what he wants..

LE. You are programmer..

I am a hardware guy...

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by straightlight » Tue Aug 07, 2018 1:13 am

I am a hardware guy...
If you are the hardware guy, then since Opencart is not a hardware, different development have been defined. ;D

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 dun7ill » Wed Aug 08, 2018 3:21 pm

straightlight wrote:
Mon Aug 06, 2018 8:13 pm
It is quite easy to change, indeed. In admin/controller/sale/order.php file,

find all instances of:

Code: Select all

foreach ($products as $product) {
add above each:

Code: Select all

$this->load->model('catalog/product');
Then, below each instances of:

Code: Select all

foreach ($products as $product) {
add below each:

Code: Select all

$product_info = $this->model_catalog_product->getProduct($product['product_id']);
Then, find all instances of:

Code: Select all

'model'      => $product['model'],
add below each:

Code: Select all

'mpn'     => $product_info['mpn'],
Then, in your admin/language/en-gb/sale/order_form.php file,

find:

Code: Select all

$_['column_model']               = 'Model';
add below:

Code: Select all

$_['column_mpn'] = 'MPN';
Then, in your admin/view/template/sale/order_form.twig file,

find:

Code: Select all

<td class="text-left">{{ column_model }}</td>
add below:

Code: Select all

<td class="text-left">{{ column_mpn }}</td>
Then, find:

Code: Select all

<td class="text-left">{{ order_product.mpn }}</td>

Then, find:

Code: Select all

<td class="text-center" colspan="X">{{ text_no_results }}</td>
Increment the X value that you see by 1.

In catalog/controller/api/order.php file,

find all instances of:

Code: Select all

foreach ($this->cart->getProducts() as $product) {
add above each:

Code: Select all

$this->load->model('catalog/product');
Then, below all instances of:

Code: Select all

foreach ($this->cart->getProducts() as $product) {
$product_info = $this->model_catalog_product->getProduct($product['product_id']);

Then, find all instances of:

Code: Select all

'model'      => $product['model'],
add below each:

Code: Select all

'mpn'   => $product['mpn'],
Then, in catalog/controller/mail/order.php file,

find:

Code: Select all

$data['text_model'] = $language->get('text_model');
add below:

Code: Select all

$data['text_mpn'] = $language->get('text_mpn');
Then, find all instances of:

Code: Select all

foreach ($order_products as $order_product) {
add above each:

Code: Select all

$this->load->model('catalog/product');
Then, below all instances of:

Code: Select all

foreach ($order_products as $order_product) {
add:

Code: Select all

$product_info = $this->model_catalog_product->getProduct($order_product['product_id']);
Then, find all instances of:

Code: Select all

'model'    => $order_product['model'],
add below each:

Code: Select all

'mpn'   => $product_info['mpn'],
Then, in catalog/language/en-gb/mail/order_add.php file,

find:

Code: Select all

$_['text_model']            = 'Model';
add below:

Code: Select all

$_['text_mpn']               = 'MPN';
In catalog/view/theme/<your_theme>/template/mail/order_add , edit and alert.twig file (if applied),

find all instances of:

Code: Select all

<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">{{ text_model }}</td>
add below each:

Code: Select all

<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">{{ text_mpn }}</td>
Then, still on each of these TWIG files, find (if applied):

Code: Select all

<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">{{ product.model }}</td>
add below each:

Code: Select all

<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">{{ product.mpn }}</td>
This should resolved the issue.
Dear,

I can't find this code in my file :

Code: Select all

<td class="text-left">{{ order_product.mpn }}</td>
Also could you please explain this more for me :

Then, find:

Code: Select all

<td class="text-center" colspan="X">{{ text_no_results }}</td>
Increment the X value that you see by 1.

New member

Posts

Joined
Mon Nov 06, 2017 5:15 am

Post by xxvirusxx » Wed Aug 08, 2018 6:15 pm

straightlight wrote:
Tue Aug 07, 2018 1:13 am
If you are the hardware guy, then since Opencart is not a hardware, different development have been defined. ;D
Yes, but still wanna try to help...for free :laugh:

@dun7ill

You want MPN on order info (extension and code posted), or MPN on order received on mail?

Code posted by @straightlight

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by dun7ill » Wed Aug 08, 2018 10:56 pm

xxvirusxx wrote:
Wed Aug 08, 2018 6:15 pm
straightlight wrote:
Tue Aug 07, 2018 1:13 am
If you are the hardware guy, then since Opencart is not a hardware, different development have been defined. ;D
Yes, but still wanna try to help...for free :laugh:

@dun7ill

You want MPN on order info (extension and code posted), or MPN on order received on mail?

Code posted by @straightlight
WOW! it's work fine.
Yes I need to show MPN only in admin panel.

Thank you so much.

New member

Posts

Joined
Mon Nov 06, 2017 5:15 am
Who is online

Users browsing this forum: No registered users and 219 guests