Author Topic: see the sku  (Read 21261 times)

Offline ygalbrami

  • Full Member
  • ***
  • Posts: 128
  • Karma: +9/-2
    • View Profile
see the sku
« on: June 01, 2013, 11:18:27 AM »
is there any way so i can see the sku next to product name?
i need this when buyer checkout in page: index.php?rt=checkout/confirm

i try a lot of option but i can make this happend,

please help me.

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: see the sku
« Reply #1 on: June 03, 2013, 07:59:27 AM »
You need to change template to display the SKU and possibly you will need to add it in the controller to be passed to the view.
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline ygalbrami

  • Full Member
  • ***
  • Posts: 128
  • Karma: +9/-2
    • View Profile
Re: see the sku
« Reply #2 on: June 03, 2013, 08:30:51 AM »
Can you please give me code to add or change? I want the code will be a code of a ante cart I don't want to use my code

Thanks

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2048
  • Karma: +319/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: see the sku
« Reply #3 on: June 04, 2013, 08:04:07 AM »
open file core/lib/cart.php... go to line 247 and add sku into array
Code: [Select]
$result = array(
        'product_id'   => $product_query['product_id'],
        'name'         => $product_query['name'],
        'model'        => $product_query['model'],
        'shipping'     => $product_query['shipping'],
        'option'       => $option_data,
        'download'     => $download_data,
        'quantity'     => $quantity,
        'minimum'      => $product_query['minimum'],
        'maximum'      => $product_query['maximum'],
        'stock'        => $stock,
        'price'        => ($price + $option_price),
        'total'        => ($price + $option_price) * $quantity,
        'tax_class_id' => $product_query['tax_class_id'],
        'weight'       => $product_query['weight'],
        'weight_class' => $product_query['weight_class'],
        'length'       => $product_query['length'],
        'width'        => $product_query['width'],
        'height'       => $product_query['height'],
        'length_class' => $product_query['length_class'],
        'ship_individually' => $product_query['ship_individually'],
        'shipping_price' => $product_query['shipping_price'],
        'free_shipping' => $product_query['free_shipping'],
        'sku' => $product_query['sku']
  );
Then open core/lib/order and add sku there (line 266):
Code: [Select]
    $product_data[] = array(
        'product_id' => $product['product_id'],
'name'       => $product['name'],
        'model'      => $product['model'],
        'option'     => $option_data,
'download'   => $product['download'],
'quantity'   => $product['quantity'],
'price'      => $product['price'],
'sku'        => $product['sku'],
        'total'      => $product['total'],
'tax'        => $this->tax->calcTotalTaxAmount($product['total'],$product['tax_class_id']),
'stock'      => $product['stock']);

now you can see sku on your template, i mean storefront/view/default_html5/template/pages/checkout/confirm.tpl ...or old default template
« Last Edit: June 04, 2013, 08:08:04 AM by abolabo »
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline ygalbrami

  • Full Member
  • ***
  • Posts: 128
  • Karma: +9/-2
    • View Profile
Re: see the sku
« Reply #4 on: June 04, 2013, 04:11:01 PM »
thank you so so much.
i have do it and this work.
i have try to make it work on other file, on this file in admin panel: admin\view\default\template\responses\sale\order_invoice.tpl

so when buyer will make an order i will go to the admin panel, i will press on print invoice and i will see the SKU

so i have add this code to the file: order_invoice.tpl

Code: [Select]
<?php echo $product['sku']; ?>
and i have added this code to this file: admin\controller\pages\sale\order.php

Code: [Select]
'sku'      => $order_product['sku'],
to the line: 354

what i am doing wrong?
and how to make this work?

Big Thanks

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2048
  • Karma: +319/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: see the sku
« Reply #5 on: June 04, 2013, 04:40:04 PM »
i think you try to edit wrong controller.
admin\view\default\template\responses\sale\order_invoice.tpl
and controller is "response" too   -    admin/controller/responses/sale/invoice.php

“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline ygalbrami

  • Full Member
  • ***
  • Posts: 128
  • Karma: +9/-2
    • View Profile
Re: see the sku
« Reply #6 on: June 04, 2013, 05:12:03 PM »
I have try this but its not working any idia why?


Offline ygalbrami

  • Full Member
  • ***
  • Posts: 128
  • Karma: +9/-2
    • View Profile
Re: see the sku
« Reply #7 on: June 04, 2013, 06:40:45 PM »
in the file: invoice.php

i make this change on the line: 138

Code: [Select]
$product_data[ ] = array(
'name'  => $product[ 'name' ],
'model' => $product[ 'model' ],
'sku'   => $product[ 'sku' ],
'option' => $option_data,
'quantity' => $product[ 'quantity' ],
'price' => $this->currency->format($product[ 'price' ], $order_info[ 'currency' ], $order_info[ 'value' ]),
'total' => $this->currency->format($product[ 'total' ], $order_info[ 'currency' ], $order_info[ 'value' ])
);

and in the file: order_invoice.tpl
i put this:
Code: [Select]
<?php echo $product['model'] .  $product['sku']; ?>in line: 72

this don't work what is wrong?

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2048
  • Karma: +319/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: see the sku
« Reply #8 on: June 06, 2013, 07:08:36 AM »
i digged into code and found that order data does not contain sku.. i can't give you quick solution right now.
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline ygalbrami

  • Full Member
  • ***
  • Posts: 128
  • Karma: +9/-2
    • View Profile
Re: see the sku
« Reply #9 on: June 06, 2013, 07:30:23 AM »
Ok please when you will have this cost post it here I really need that code

Thank you so much in advance

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: see the sku
« Reply #10 on: June 06, 2013, 11:12:45 AM »
There are 2 solutions but both require coding:

1. Based on the product details in the order, load product SKU and Attributes SKUs.
Need to change: Controllers, Models and template on admin side. Not visible to customers.

2. Add SKU details to the order table and display in order details screens.
Need to change: Admin Controllers, Models and template on admin side, order creation controller on storefront side. And finally alter order tables to add these details.


Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline ygalbrami

  • Full Member
  • ***
  • Posts: 128
  • Karma: +9/-2
    • View Profile
Re: see the sku
« Reply #11 on: June 06, 2013, 11:17:30 AM »
In few hours I will give you a code the join tables and give me the SKU but I want this code will be transformed to abantecart code and not custom code.
And yes I need that it will be invisible to user.
« Last Edit: June 06, 2013, 11:43:21 AM by abantecart »

Offline ygalbrami

  • Full Member
  • ***
  • Posts: 128
  • Karma: +9/-2
    • View Profile
Re: see the sku
« Reply #12 on: June 06, 2013, 05:14:57 PM »
this is the code that work on the file:

Code: [Select]
$select_ab_order_products = mysql_query ("SELECT * FROM ab_order_products INNER JOIN ab_products ON ab_order_products.product_id = ab_products.product_id WHERE ab_order_products.order_id='$order_id'") or die ("can't select");
foreach ($products as $product) {
$get_row_product_id = mysql_fetch_array ($select_ab_order_products) ;

this code do the work but is not AbanteCart card, how can i put this so this will be like AbanteCart cart code and not custom code?

thanks

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2048
  • Karma: +319/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: see the sku
« Reply #13 on: June 07, 2013, 04:01:02 AM »
your code ignores sku that set to product option.
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline ygalbrami

  • Full Member
  • ***
  • Posts: 128
  • Karma: +9/-2
    • View Profile
Re: see the sku
« Reply #14 on: June 07, 2013, 06:34:40 AM »
I make some change in my code so that is work very good

Code: [Select]
$connect_this = mysql_connect(DB_HOSTNAME,DB_DATABASE,DB_PASSWORD) or die("error connect");
$mysql_db = mysql_select_db("ismyvodc_mystore")or die("error db");
$get_orderid = $_GET['order_id'];
$select_ab_order_products = mysql_query("SELECT * FROM order_products INNER JOIN products ON order_products.product_id = products.product_id WHERE order_products.order_id='$get_orderid'") or die ("can't select");

and after this code:
Code: [Select]
<?php foreach ($order['product'] as $product) {i put my code:
Code: [Select]
$get_row_product_id = mysql_fetch_array($select_ab_order_products);
and i put this to see the sku:
Code: [Select]
<?php echo $get_row_product_id['sku']; ?>
but i need this code will be AbanteCart code.
if you can please help me with that?

i send you an image that show you the sku.

all the code i put in the file: order_invoice.tpl

 

Powered by SMFPacks Social Login Mod