Rissinko Posted July 31, 2017 Share Posted July 31, 2017 Hi,i am working on summary page for bankwire module in my shop and i have problem to check if product is gift ... is anyone know which class is used in shopping-cart-product-line.tpl for storing this information ? or how can i get this info in bankwire module ?? in shopping-cart-product-line.tpl it is stored in $product.gift but class cart do not contain 'gift' in information about product. Link to comment Share on other sites More sharing options...
Scully Posted July 31, 2017 Share Posted July 31, 2017 I wasn't aware that there is a gift flag in products. Can you upload a screenshot or explain exactely where gift is set? Link to comment Share on other sites More sharing options...
Rissinko Posted July 31, 2017 Author Share Posted July 31, 2017 (edited) Here is the picture of the code and print_r of the $product from shopping-cart-product-line.tpl gift is as last info in array... Array ( [id_product_attribute] => 0 [id_product] => 691 [cart_quantity] => 1 [id_shop] => 1 [name] => Reklamné pero [is_virtual] => 0 [description_short] => Reklamné pero Tvojakáva. Darček k objednávke. [available_now] => [available_later] => ZASIELAME IHNEĎ [id_category_default] => 180 [id_supplier] => 0 [id_manufacturer] => 0 [on_sale] => 0 [ecotax] => 0.000000 [additional_shipping_cost] => 0.00 [available_for_order] => 1 [price] => 0 [active] => 1 [unity] => [unit_price_ratio] => 0.000000 [quantity_available] => -165 [width] => 0.000000 [height] => 0.000000 [depth] => 0.000000 [out_of_stock] => 2 [weight] => 0.000000 [date_add] => 2017-04-21 13:27:45 [date_upd] => 2017-07-24 13:00:06 [quantity] => 1 [link_rewrite] => reklamne-pero [category] => darceky [unique_id] => 00000006910000000000778 [id_address_delivery] => 778 [advanced_stock_management] => 0 [supplier_reference] => [customization_quantity] => [id_customization] => [reference] => [ean13] => [upc] => [minimal_quantity] => 1 [wholesale_price] => 0.000000 [id_image] => 6[spam-filter]1133 [legend] => Reklamné pero [reduction_type] => 0 [stock_quantity] => -165 [price_without_reduction] => 0.5 [price_with_reduction] => 0.5 [price_with_reduction_without_tax] => 0.416667 [total] => 0 [total_wt] => 0 [price_wt] => 0 [reduction_applies] => [quantity_discount_applies] => [allow_oosp] => 1 [features] => Array ( ) [rate] => 20 [tax_name] => DPH SK 20% [price_without_quantity_discount] => 0.5 [reduction_formatted] => 0,00 € [gift] => 1 ) Edited July 31, 2017 by Rissinko (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted July 31, 2017 Share Posted July 31, 2017 (edited) I still don't know where in products page this flag is set. but anyway... try {if $product.gift == 1} Why: the array might be always set - with 0 or 1. If unsure, just output the value into your tpl and you will set if its set and how it is set if it is not set. Edited July 31, 2017 by Scully (see edit history) Link to comment Share on other sites More sharing options...
Rissinko Posted July 31, 2017 Author Share Posted July 31, 2017 Maybe i didn't write it right so i try it again.. I am working on summary page in bankwire module. I know that in shopping-cart-product-line.tpl there is variable $product.gift And i need to know from what class i get it or how i can get it on my custom page because class Cart.php and function getproducts do not contain this info in array. maybe it is from class Product but i somehow can't get info from this class in module... Link to comment Share on other sites More sharing options...
Scully Posted July 31, 2017 Share Posted July 31, 2017 load the product object? Link to comment Share on other sites More sharing options...
Scully Posted July 31, 2017 Share Posted July 31, 2017 I am guessing you're on 1.7.something. I only know ps up to 1.6. but it can't be that difficult. Link to comment Share on other sites More sharing options...
Rissinko Posted August 1, 2017 Author Share Posted August 1, 2017 I am on 1.6 ...yes i think that i need load product object but i had some issues with it.... Link to comment Share on other sites More sharing options...
Rissinko Posted August 1, 2017 Author Share Posted August 1, 2017 So i tried to load object and print_r array but no gift info there... public static function getProductInfo($product_id) { $product = new Product ($product_id, $lang->id); print_r($product); } So anyone who knows where is this gift info stored or which class creating/using it ? Thanks Link to comment Share on other sites More sharing options...
Scully Posted August 1, 2017 Share Posted August 1, 2017 You have never answered my first question. Where is this gift flag from within products? Result - I'm out with helping. My product tables do not have a gift field at all - hence also no such a flag in the products object. Link to comment Share on other sites More sharing options...
Rissinko Posted August 2, 2017 Author Share Posted August 2, 2017 (edited) This flag is in shopping-cart-product-line.tpl it shows when the product is added from cart rule like gift to the order....I really like to give you these informations but i don't know this is why i am looking for help because i can't find anything about it here and in prestashop codes/tables also. Edited August 2, 2017 by Rissinko (see edit history) Link to comment Share on other sites More sharing options...
Rissinko Posted August 2, 2017 Author Share Posted August 2, 2017 Solved.. I found in Cart class funcion getSummaryDetails() which contains informations about gifts in cart. 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