Post by vinzer » Tue Apr 20, 2010 9:15 am

Hello all !
I am trying to add field SKU in to the email which goes to the customer after the checkout. Basically field Model already avialable there, so my part is just to add additional field SKU.
So far I found file: webstore/catalog/model/checkout/order.php

Iside of it there is a part where we iserting in to the order_product table some info about the prouct.
I simply added there the following:

........................., sku = '" . $this->db->escape($product['sku']) . "'");

And of course I created 'sku' in the table.

My problem is that I can not find where $product['sku'] should be defined. In my case when customer check out now it does not insert anything in to the 'sku' field of the table. But as soon as I change 'sku' to for example 'model' like this:

sku = '" . $this->db->escape($product['model']) . "'");

it copies MODEL in to the new SKU field.

Please help me where, in which file (probably under Library folder) should I define $product['sku']. I understand that this SKU value should be copied from the product table, similar how it done with model field.

Thank you,
Vlad

Newbie

Posts

Joined
Wed Mar 31, 2010 10:22 am

Post by vinzer » Tue Apr 20, 2010 9:50 am

or simply explain to me please what does it mean:

$this->db->escape($product['sku'])

I understand that there is localy decalred DB, it is under /system/library and it is described in db.php
But what about escape($product['sku']) ?

For example I understand that $product['model'] will return MODEL field of the product table.
How can I get SKU field of the product table ?
When I am trying to request like this -- $product['sku'] it returns nothing which means that I have somewhere to describe that field SKU should be requested from the DB.

Help me please.

Newbie

Posts

Joined
Wed Mar 31, 2010 10:22 am

Post by Qphoria » Tue Apr 20, 2010 10:13 am

I assume you've entered a value for SKU in the product edit area?
If you want to add sku to the email you can do this:

1. EDIT: catalog/model/checkout/order.php

2. FIND:
'model' => $product['model'],

3. AFTER, ADD:
'sku' => $product['sku'],

4. EDIT: catalog/view/theme/default/template/mail/order_confirm.tpl

5. FIND:

Code: Select all

<td align="left"><?php echo $product['model']; ?></td>
6. REPLACE WITH:

Code: Select all

<td align="left"><?php echo $product['model']; ?><br/><?php echo $product['sku']; ?></td>

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by vinzer » Tue Apr 20, 2010 10:37 am

SKU value in the product area is entered.
I tried your suggestion but it came wit empty result :(
Basically what I did and what I understand:

3. AFTER, ADD:
'sku' => $product['sku'],

Here we just define SKU for template, BUT $product['sku'] is not defined, I mean it has no value at this point



6. REPLACE WITH:

Code: Select all
<td align="left"><?php echo $product['model']; ?><br/><?php echo $product['sku']; ?></td>

Here we just display the SKU value in the template, but again value SKU comes EMPTY due to the fact that in the order.php we did not assigned any value to this 'sku'.

Please tell me where should 'sku' be defined ? I am under 1.4.6
My SKU field is defined for each product inside the table: product

Thank you,
Vlad

Newbie

Posts

Joined
Wed Mar 31, 2010 10:22 am

Post by Qphoria » Tue Apr 20, 2010 11:16 am

ah, yea sorry.

try this. Leave the above changes

1. EDIT: catalog/model/checkout/order.php

2. FIND:

Code: Select all

$order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$product['order_product_id'] . "'");
3. AFTER, ADD:

Code: Select all

$order_product_info = $this->db->query("SELECT * FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product['product_id'] . "'");
4. FIND:

Code: Select all

'sku' => $product['sku'],
5. REPLACE WITH:

Code: Select all

'sku' => $order_product_info->row['sku'],

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by vinzer » Tue Apr 20, 2010 11:41 am

Now we are talking :)

Thank you very much for your help, it works now !!

Vlad

Newbie

Posts

Joined
Wed Mar 31, 2010 10:22 am

Post by Purebeads » Sat May 15, 2010 7:02 pm

I found this thread during a search. I'd like to suggest that SKU's be included automatically in the catalogue and also in the notification emails. (Well, perhaps in the catalogue it should be optional.) Many retailers like their customers to identify products by their SKU's, so SKU's are not just an internal thing. In my case, I don't use SKU's. However, in the SKU field I intent to put the bin number where the product can be found, and I would like that bin number to appear in the notification emails (from which I'll be picking the orders). I haven't tried the fix above yet, but I will this evening.

Active Member

Posts

Joined
Fri Apr 30, 2010 12:07 pm

Post by Purebeads » Sun May 16, 2010 3:05 am

Qphoria wrote: 1. EDIT: catalog/model/checkout/order.php

2. FIND:

Code: Select all

$order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$product['order_product_id'] . "'");
3. AFTER, ADD:

Code: Select all

$order_product_info = $this->db->query("SELECT * FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product['product_id'] . "'");
Qphoria, I just want to say that I found TWO instances of the above code, and I added the additional code after both of them. Is that what I should have done? Or should I have added the additional code after just the first instance?

Active Member

Posts

Joined
Fri Apr 30, 2010 12:07 pm

Post by Purebeads » Thu May 20, 2010 6:28 pm

I didn't read this thread carefully before I installed this modification. What I need is the SKU information to be sent to ME, not the customer. Can that be done without causing one of the developers a lot of work?

Active Member

Posts

Joined
Fri Apr 30, 2010 12:07 pm

Post by spitos » Thu Sep 22, 2011 3:07 am

Thanks Qphoria, this was very handy!

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK
Who is online

Users browsing this forum: No registered users and 58 guests