Author Topic: see the sku  (Read 21298 times)

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 #15 on: June 07, 2013, 07:27:44 AM »
i said about product options... not product sku.
Abantecart allow to set sku for option too.
For ex. you have product with name "shoes". Shoes have 2 options: size and color. For all combination of this properties merchant can set different values of sku. that's why changing of core is difficult right now.
You showed me your custom, partial, solution.
Why do you don't change method getOrderProducts() on file public_html/admin/model/sale/order.php ?
it used by sale/invoice.php controller.
FYI. you don't need to create new connection to database. Instance of db-class is already in memory.
you can do
Code: [Select]
$this->db->query($sql) in any controllers and models
or
Code: [Select]
$registry = Registry::getInstance()
$registry->get('db')->query(sql);
everywhere in code

But personally i prefer to create custom extension with hooks of controllers.. this approach saves your changes after cart upgrade.
“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 #16 on: June 07, 2013, 07:48:12 AM »
thank you so much for this, this is want i need.

i have the code to select db
Code: [Select]
SELECT * FROM order_products INNER JOIN products ON order_products.product_id = products.product_id WHERE order_products.order_id='$get_orderid

can you show me how to put my code to this:
Code: [Select]
$this->db->query($sql)
thanks again very very much

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 #17 on: June 07, 2013, 08:39:57 AM »
$result = $this->db->query("SELECT * FROM order_products INNER JOIN products ON order_products.product_id = products.product_id WHERE order_products.order_id='".(int)$order_id."'" );
var_dump($result->rows); 
$result->rows - is array with all rows.
“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 #18 on: June 07, 2013, 10:10:54 AM »
i put this on invoice.php

Code: [Select]
$result = $this->db->query("SELECT * FROM order_products INNER JOIN products ON order_products.product_id = products.product_id WHERE order_products.order_id='".(int)$order_id."'" );
 


foreach ($result->rows as $product) {
$product['sku'];

}

echo $product['sku'];

and i see the sku at the top of the page so it work

but when i put the line into: order_invoice.tpl - i don't see the sku why is that?
what i am doing wrong?
Code: [Select]
echo $product['sku'];


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 #19 on: June 07, 2013, 10:24:29 AM »
try to write

echo $orders['products']['sku'];

controller $this->data['orders'] become $orders variable inside tpl..
“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 #20 on: June 08, 2013, 02:47:22 PM »
So sorry but its don't work.
I will use my code for this.

The best way I see to use a AbanteCart cart code is when users make an order it will put in do database the SKU then is no problem to get the data.

 

Powered by SMFPacks Social Login Mod