[Skip to main content](#vessel-content)

#   File Download Link in listing\_img\_title.php

##

- **[scrapper](/forum/user/26815-scrapper "View scrapper's Profile")**
- [![scrapper's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/26815-scrapper "View scrapper's Profile") Topic Author
- [ Offline](/forum/user/26815-scrapper)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 6 months ago [\#150974](#150974) by [scrapper](/forum/user/26815-scrapper "View scrapper's Profile")  *[File Download Link in listing\_img\_title.php](/forum/32-content-creation/867197-file-download-link-in-listing-img-title-php#150974 "Hi, I am trying to display certain text &quot;True&quot; if the downloadable files exists for this product on the product/listing&#95;img&#95;title view, I am using following php code. Please let me know where I have gone wrong.  For some reasons I am not able to use anything from $this-&gt;element in listing&#95;img&#95;title.php. I have also tried following but still no luck.  Please help me fix this issue.")* was created by *[scrapper](/forum/user/26815-scrapper "View scrapper's Profile")*

Hi, I am trying to display certain text "True" if the downloadable files exists for this product on the product/listing_img_title view, I am using following php code.
Please let me know where I have gone wrong.
Code:

&lt;?php if ($this-&gt;element-&gt;files) { echo "True"; } echo $this-&gt;element-&gt;product_code; if (!empty ($this-&gt;element-&gt;product_url)) { echo JText :: sprintf('MANUFACTURER_URL', '&lt;a href="' . $this-&gt;element-&gt;product_url . '" target="_blank"&gt;' . $this-&gt;element-&gt;product_url . '&lt;/a&gt;'); } ?&gt;

For some reasons I am not able to use anything from $this-&gt;element in listing_img_title.php.
I have also tried following but still no luck. Code:

&lt;?php if(!empty($this-&gt;element-&gt;extraData-&gt;bottomMiddle)) echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;bottomMiddle); if(!empty($this-&gt;element-&gt;extraData-&gt;bottomEnd)) echo implode("\r\n",$this-&gt;element-&gt;extraData-&gt;bottomEnd); ?&gt;

Please help me fix this issue.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODY3MTk3LWZpbGUtZG93bmxvYWQtbGluay1pbi1saXN0aW5nLWltZy10aXRsZS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86315
- Thank you received: 14276
-
-

12 years 6 months ago [\#150994](#150994) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[File Download Link in listing\_img\_title.php](/forum/32-content-creation/867197-file-download-link-in-listing-img-title-php#150994 "Hi, I am trying to display certain text &quot;True&quot; if the downloadable files exists for this product on the product/listing&#95;img&#95;title view, I am using following php code. Please let me know where I have gone wrong.  For some reasons I am not able to use anything from $this-&gt;element in listing&#95;img&#95;title.php. I have also tried following but still no luck.  Please help me fix this issue.")*

Hi,

First, in listing_img_title, it's not $this-&gt;element but $this-&gt;row that you want to use.
Second, there are no files and no extra data loaded in that view file since there is no need to load the files data of the products in listings.
This means that you'll have to write a SQL query in order to load the files of the products yourself from the hikashop_file table.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODY3MTk3LWZpbGUtZG93bmxvYWQtbGluay1pbi1saXN0aW5nLWltZy10aXRsZS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[scrapper](/forum/user/26815-scrapper "View scrapper's Profile")**
- [![scrapper's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/26815-scrapper "View scrapper's Profile") Topic Author
- [ Offline](/forum/user/26815-scrapper)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 6 months ago -  12 years 6 months ago [\#151026](#151026) by [scrapper](/forum/user/26815-scrapper "View scrapper's Profile")  Replied by *[scrapper](/forum/user/26815-scrapper "View scrapper's Profile")* on topic *[File Download Link in listing\_img\_title.php](/forum/32-content-creation/867197-file-download-link-in-listing-img-title-php#151026 "Hi, I am trying to display certain text &quot;True&quot; if the downloadable files exists for this product on the product/listing&#95;img&#95;title view, I am using following php code. Please let me know where I have gone wrong.  For some reasons I am not able to use anything from $this-&gt;element in listing&#95;img&#95;title.php. I have also tried following but still no luck.  Please help me fix this issue.")*

This does not work for me.
I tried to print the row array with its data, but I dont see file download arrays anywhere. see blow. Code:

&lt;?php ini_set('xdebug.var_display_max_data', 0); echo '&lt;pre&gt;'; print_r($this-&gt;row); echo '&lt;/pre&gt;';?&gt;

I get following result with above php, I dont see downloadable file arrays.
Code:

stdClass Object ( [product_id] =&gt; 260 [product_parent_id] =&gt; 0 [product_name] =&gt; Networking &amp; O/S installation Services [product_description] =&gt; Professional services that includes networking installation, troubleshooting, configuration and installation of operating systems across the entire network. [product_quantity] =&gt; -1 [product_code] =&gt; networking-os-installation [product_published] =&gt; 1 [product_hit] =&gt; 53 [product_created] =&gt; 1378243587 [product_sale_start] =&gt; 0 [product_sale_end] =&gt; 0 [product_delay_id] =&gt; 0 [product_tax_id] =&gt; 0 [product_type] =&gt; main [product_vendor_id] =&gt; 0 [product_manufacturer_id] =&gt; 0 [product_url] =&gt; [product_weight] =&gt; 0.000 [product_keywords] =&gt; [product_weight_unit] =&gt; kg [product_modified] =&gt; 1378243587 [product_meta_description] =&gt; [product_dimension_unit] =&gt; m [product_width] =&gt; 0.000 [product_length] =&gt; 0.000 [product_height] =&gt; 0.000 [product_max_per_order] =&gt; 0 [product_access] =&gt; all [product_group_after_purchase] =&gt; [product_min_per_order] =&gt; 0 [product_contact] =&gt; 0 [product_last_seen_date] =&gt; 1396391193 [product_sales] =&gt; 1 [product_waitlist] =&gt; 0 [product_layout] =&gt; [product_average_score] =&gt; 0 [product_total_vote] =&gt; 0 [product_page_title] =&gt; [product_alias] =&gt; [product_price_percentage] =&gt; 0.0000000 [product_msrp] =&gt; 0.0000000 [product_canonical] =&gt; [cond] =&gt; used [alias] =&gt; networking-o-s-installation-services [file_id] =&gt; 766 [file_name] =&gt; [file_description] =&gt; [file_path] =&gt; computer-networking.jpg [file_type] =&gt; product [file_ref_id] =&gt; 260 [file_free_download] =&gt; 0 [file_ordering] =&gt; 0 [file_limit] =&gt; 0 [prices] =&gt; Array ( [0] =&gt; stdClass Object ( [price_id] =&gt; 243 [price_currency_id] =&gt; 4 [price_product_id] =&gt; 260 [price_value] =&gt; 500.00000 [price_min_quantity] =&gt; 0 [price_access] =&gt; all [price_value_with_tax] =&gt; 500.00000 [taxes] =&gt; Array ( ) ) ) [badges] =&gt; Array ( ) )

My question is how I can access the file download array elements in Hikashop listing_img_title view.
For example I want to echo a text "True" if free downloadable file exists for a product.
Code:

&lt;?php if (array_key_exists($this-&gt;row-&gt;downloadable_file)) { echo "True"; } echo $this-&gt;row-&gt;downloadable_file; ?&gt; &lt;/div&gt;

Please help

Last edit: 12 years 6 months ago by [scrapper](/forum/user/26815-scrapper "View scrapper's Profile"). Reason: more detailed explanation

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODY3MTk3LWZpbGUtZG93bmxvYWQtbGluay1pbi1saXN0aW5nLWltZy10aXRsZS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86315
- Thank you received: 14276
-
-

12 years 6 months ago [\#151045](#151045) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[File Download Link in listing\_img\_title.php](/forum/32-content-creation/867197-file-download-link-in-listing-img-title-php#151045 "Hi, I am trying to display certain text &quot;True&quot; if the downloadable files exists for this product on the product/listing&#95;img&#95;title view, I am using following php code. Please let me know where I have gone wrong.  For some reasons I am not able to use anything from $this-&gt;element in listing&#95;img&#95;title.php. I have also tried following but still no luck.  Please help me fix this issue.")*

You say it doesn't work, but it does. You can the product data, which was not the case with $this-&gt;element.
Now as I said in my previous email, the files data is not load on that view file since it is not needed. So you need to load it yourself from the database with a mysql query on the hikashop_file table. You cannot access it directly in PHP as it's not loaded by HikaShop there.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODY3MTk3LWZpbGUtZG93bmxvYWQtbGluay1pbi1saXN0aW5nLWltZy10aXRsZS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[scrapper](/forum/user/26815-scrapper "View scrapper's Profile")**
- [![scrapper's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/26815-scrapper "View scrapper's Profile") Topic Author
- [ Offline](/forum/user/26815-scrapper)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 6 months ago [\#151225](#151225) by [scrapper](/forum/user/26815-scrapper "View scrapper's Profile")  Replied by *[scrapper](/forum/user/26815-scrapper "View scrapper's Profile")* on topic *[File Download Link in listing\_img\_title.php](/forum/32-content-creation/867197-file-download-link-in-listing-img-title-php#151225 "Hi, I am trying to display certain text &quot;True&quot; if the downloadable files exists for this product on the product/listing&#95;img&#95;title view, I am using following php code. Please let me know where I have gone wrong.  For some reasons I am not able to use anything from $this-&gt;element in listing&#95;img&#95;title.php. I have also tried following but still no luck.  Please help me fix this issue.")*

Is it not possible to load the same php code in img_title.php which is loaded with show_block_product_files? This way I can use it with img_title.php. But the problem is I dont know how to do it.

Regarding I have to load it by myself from the database with a mysql query on the hikashop_file table. I am new to PHP and mysql and I dont know where to start. please help.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODY3MTk3LWZpbGUtZG93bmxvYWQtbGluay1pbi1saXN0aW5nLWltZy10aXRsZS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[scrapper](/forum/user/26815-scrapper "View scrapper's Profile")**
- [![scrapper's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/26815-scrapper "View scrapper's Profile") Topic Author
- [ Offline](/forum/user/26815-scrapper)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 6 months ago -  12 years 6 months ago [\#151344](#151344) by [scrapper](/forum/user/26815-scrapper "View scrapper's Profile")  Replied by *[scrapper](/forum/user/26815-scrapper "View scrapper's Profile")* on topic *[File Download Link in listing\_img\_title.php](/forum/32-content-creation/867197-file-download-link-in-listing-img-title-php#151344 "Hi, I am trying to display certain text &quot;True&quot; if the downloadable files exists for this product on the product/listing&#95;img&#95;title view, I am using following php code. Please let me know where I have gone wrong.  For some reasons I am not able to use anything from $this-&gt;element in listing&#95;img&#95;title.php. I have also tried following but still no luck.  Please help me fix this issue.")*

Bump!!!

nicolas, if you help me with this issue. I will paint your face on the surface of the moon or probably I will consider you a very good human being the one who likes to help others. Perhaps I will print posters with your face on it and slogan that Nicolas is a great man and a helping hand.

So, nicolas, please help me with this. How can I echo True in listing_img_title.php if downloadable file exists. Or if possible how can I show the download link to the file in listing_img_title.php page.

I will send you the sample of the poster when I finish designing it. Thank you Nicolas

Last edit: 12 years 6 months ago by [scrapper](/forum/user/26815-scrapper "View scrapper's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODY3MTk3LWZpbGUtZG93bmxvYWQtbGluay1pbi1saXN0aW5nLWltZy10aXRsZS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

12 years 6 months ago [\#151362](#151362) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[File Download Link in listing\_img\_title.php](/forum/32-content-creation/867197-file-download-link-in-listing-img-title-php#151362 "Hi, I am trying to display certain text &quot;True&quot; if the downloadable files exists for this product on the product/listing&#95;img&#95;title view, I am using following php code. Please let me know where I have gone wrong.  For some reasons I am not able to use anything from $this-&gt;element in listing&#95;img&#95;title.php. I have also tried following but still no luck.  Please help me fix this issue.")*

Hello,
Using this kind of code to load your product files information will probably do the job : Code:

$this-&gt;database = JFactory::getDBO(); $query='SELECT * FROM '.hikashop_table('file').' WHERE file_ref_id ='.$YOURPRODUCTID; $this-&gt;database-&gt;setQuery($query); $product_files = $this-&gt;database-&gt;loadObjectList();

The following user(s) said Thank You: [scrapper](/forum/user/26815-scrapper "View scrapper's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODY3MTk3LWZpbGUtZG93bmxvYWQtbGluay1pbi1saXN0aW5nLWltZy10aXRsZS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[scrapper](/forum/user/26815-scrapper "View scrapper's Profile")**
- [![scrapper's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/26815-scrapper "View scrapper's Profile") Topic Author
- [ Offline](/forum/user/26815-scrapper)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 6 months ago [\#151660](#151660) by [scrapper](/forum/user/26815-scrapper "View scrapper's Profile")  Replied by *[scrapper](/forum/user/26815-scrapper "View scrapper's Profile")* on topic *[File Download Link in listing\_img\_title.php](/forum/32-content-creation/867197-file-download-link-in-listing-img-title-php#151660 "Hi, I am trying to display certain text &quot;True&quot; if the downloadable files exists for this product on the product/listing&#95;img&#95;title view, I am using following php code. Please let me know where I have gone wrong.  For some reasons I am not able to use anything from $this-&gt;element in listing&#95;img&#95;title.php. I have also tried following but still no luck.  Please help me fix this issue.")*

Nicolas you are a good man. thank you for the help.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODY3MTk3LWZpbGUtZG93bmxvYWQtbGluay1pbi1saXN0aW5nLWltZy10aXRsZS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.116 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
