hakeryk2 Posted August 16, 2017 Share Posted August 16, 2017 (edited) HelloWhen I call for order in API I have in associations list of bought items and it has product_name value but this is this long version with attribute category inserted in it. I want to have only product name and attribute name.In example: I want to change from: Product name: Attribute Group - Attribute Value to Product name: Attribute Value Where should I look to change this output? Edited August 16, 2017 by hakeryk2 (see edit history) Link to comment Share on other sites More sharing options...
hakeryk2 Posted August 17, 2017 Author Share Posted August 17, 2017 (edited) Ok, I figured it out. I created an override for Order class. Paste this below into override/classes/Order.php, after that remove file in cache/class_index.php class Order extends OrderCore { /* * Changes API otput of product name to shorter one * Only product name and attribute name */ public function getWsOrderRows() { $query = ' SELECT od.`id_order_detail` as `id`, od.`product_id`, od.`product_price`, od.`id_order`, od.`product_attribute_id`, od.`product_quantity`, CONCAT(pl.`name`, \': \', GROUP_CONCAT(DISTINCT (al.`name`) SEPARATOR " " )) as product_name, od.`product_reference`, od.`product_ean13`, od.`product_upc`, od.`unit_price_tax_incl`, od.`unit_price_tax_excl` FROM `'._DB_PREFIX_.'order_detail` od LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = od.`product_id`) LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = od.`product_attribute_id`) LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON ((pac.`id_attribute` = al.`id_attribute`) AND al.`id_lang` = '.Configuration::get('PS_LANG_DEFAULT').') WHERE od.`id_order` = '.(int)$this->id.' AND al.`id_lang` = '.Configuration::get('PS_LANG_DEFAULT').' GROUP BY od.`product_attribute_id`'; $result = Db::getInstance()->executeS($query); return $result; } } This is not supporting multilanguage/multishop. Edited August 17, 2017 by hakeryk2 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now