Jump to content

Problem of getting id_image & link_rewrite variables


Recommended Posts

My intention is to add product image to "Order Detail & History", therefore i copy the code from cart summary table and add into theme order-detail.tpl.

 

First try code

 


[url="{$link-getProductLink($product.id_product,%20$product.link_rewrite,%20$product.category,%20null,%20null,%20$product.id_shop,%20$product.id_product_attribute)|escape:"][img={$link-getImageLink($product.link_rewrite, $product.id_image, ][/url]

 

The above code return Question mark image, i realize $product.link_rewrite and $product.id_image return empty, here is the result of {$product|print_r}.

 

1 [product_quantity_in_stock] => 1 [product_quantity_refunded] => 0 [product_quantity_return] => 0 [product_quantity_reinjected] => 0 [product_price] => 25 [reduction_percent] => 0.00 [reduction_amount] => 0.000000 [reduction_amount_tax_incl] => 0.000000 [reduction_amount_tax_excl] => 0.000000 [group_reduction] => 0.00 [product_quantity_discount] => 0.000000 [product_ean13] => [product_upc] => [product_reference] => GWN0013C0032 [product_supplier_reference] => [product_weight] => 0.000000 [tax_computation_method] => 0 [tax_name] => [tax_rate] => 0 [ecotax] => 0.000000 [ecotax_tax_rate] => 0.000 [discount_quantity_applied] => 0 [download_hash] => [download_nb] => 0 [download_deadline] => 0000-00-00 00:00:00 [total_price_tax_incl] => 25.000000 [total_price_tax_excl] => 25.000000 [unit_price_tax_incl] => 25.000000 [unit_price_tax_excl] => 25.000000 [total_shipping_price_tax_incl] => 0.000000 [total_shipping_price_tax_excl] => 0.000000 [purchase_supplier_price] => 0.000000 [original_product_price] => 25.000000 [id_product] => 124 [id_supplier] => 0 [id_manufacturer] => 0 [id_category_default] => 4 [id_shop_default] => 1 [id_tax_rules_group] => 1 [on_sale] => 0 [online_only] => 0 [ean13] => [upc] => [quantity] => 0 [minimal_quantity] => 1 [price] => 34.000000 [wholesale_price] => 0.000000 [unity] => [unit_price_ratio] => 0.000000 [additional_shipping_cost] => 0.00 [reference] => 13C0032 [supplier_reference] => [location] => [width] => 0.000000 [height] => 0.000000 [depth] => 0.000000 [weight] => 0.000000 [out_of_stock] => 2 [quantity_discount] => 0 [customizable] => 0 [uploadable_files] => 0 [text_fields] => 0 [active] => 1 [redirect_type] => 404 [id_product_redirected] => 0 [available_for_order] => 1 [available_date] => 0000-00-00 [condition] => new [show_price] => 1 [indexed] => 1 [visibility] => both [cache_is_pack] => 0 [cache_has_attachments] => 0 [is_virtual] => 0 [cache_default_attribute] => 126 [date_add] => 2013-06-05 01:29:06 [date_upd] => 2013-07-11 20:07:45 [advanced_stock_management] => 0 [image] => Image Object ( [id] => 93 [id_image] => 93 [id_product] => 124 [position] => 3 [cover] => 0 [image_format] => jpg [source_index] => /home/goopsh65/domains/goopsh.com/public_html/img/p/index.php [folder:protected] => [existing_path:protected] => [id_lang:protected] => [id_shop:protected] => 1 [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => image [identifier:protected] => id_image [fieldsRequired:protected] => Array ( [0] => id_product ) [fieldsSize:protected] => Array ( ) [fieldsValidate:protected] => Array ( [id_product] => isUnsignedId [position] => isUnsignedInt [cover] => isBool ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [webserviceParameters:protected] => Array ( ) [image_dir:protected] => /home/goopsh65/domains/goopsh.com/public_html/img/p/ [def:protected] => Array ( [table] => image [primary] => id_image [multilang] => 1 [fields] => Array ( [id_product] => Array ( [type] => 1 [validate] => isUnsignedId [required] => 1 ) [position] => Array ( [type] => 1 [validate] => isUnsignedInt ) [cover] => Array ( [type] => 2 [validate] => isBool [shop] => 1 ) ) [classname] => Image [associations] => Array ( [l] => Array ( [type] => 2 [field] => id_image [foreign_field] => id_image ) ) ) [update_fields:protected] => ) [image_size] => [current_stock] => 0 [tax_calculator] => TaxCalculator Object ( [taxes] => Array ( ) [computation_method] => 1 ) [product_price_wt] => 25 [product_price_wt_but_ecotax] => 25 [total_wt] => 25.000000 [total_price] => 25.000000 [customizedDatas] => [customizationQuantityTotal] => 0 [id_address_delivery] => 4 [qty_returned] => 0 ) 1" />

 

 

After i work around of the $name and $id with below code and it returns images but wrong product. It seems like it split the id_product as the DIR instead of id_image.

 

Second try code

 


[url="{$link-getProductLink($product.id_product,%20$product.link_rewrite,%20$product.category,%20null,%20null,%20$product.id_shop,%20$product.id_product_attribute)|escape:"][img={$link-getImageLink(][/url]

 

The odd thing link_rewrite in getProductlink is working fine.

I hope that someone can advise me as i am totally lost here after few hours of attempts.

 

Thanks.

post-570804-0-28261500-1375978173_thumb.png

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...