News:

AbanteCart v1.4.2 is released.

Main Menu
support

see the sku

Started by ygalbrami, June 01, 2013, 11:18:27 AM

Previous topic - Next topic

ygalbrami

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.

abantecart

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

ygalbrami

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

abolabo

#3
open file core/lib/cart.php... go to line 247 and add sku into array
$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):
    $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
"No one is useless in this world who lightens the burdens of another."
― Charles Dickens

ygalbrami

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

<?php echo $product['sku']; ?>

and i have added this code to this file: admin\controller\pages\sale\order.php

'sku'      => $order_product['sku'],

to the line: 354

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

Big Thanks

abolabo

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

ygalbrami

I have try this but its not working any idia why?


ygalbrami

in the file: invoice.php

i make this change on the line: 138

$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: <?php echo $product['model'] .  $product['sku']; ?>
in line: 72

this don't work what is wrong?

abolabo

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

ygalbrami

Ok please when you will have this cost post it here I really need that code

Thank you so much in advance

abantecart

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

ygalbrami

#11
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.

ygalbrami

this is the code that work on the file:

$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

abolabo

your code ignores sku that set to product option.
"No one is useless in this world who lightens the burdens of another."
― Charles Dickens

ygalbrami

I make some change in my code so that is work very good

$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:
<?php foreach ($order['product'] as $product) {
i put my code:
$get_row_product_id = mysql_fetch_array($select_ab_order_products);

and i put this to see the sku:
<?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

Forum Rules Code of conduct
AbanteCart.com 2010 -