- Posts: 38
- Thank you received: 2
Template customization category/listing_div
- Sergey Romanov
-
Topic Author
- Offline
But this is category list only. It is not product list. Why to show pagination at all? I would just delete this part of code as do not have more than 20 categories on one page and this is default query limit.
So what should I do with it?
Also I cannot understand what is product/listing template? I can see list of the products in category but I never switch to ctrl=product&task=listing. I can see all products in category/listing
Please Log in or Create an account to join the conversation.
That way it would display automatically if needed.
The product listing template is used for products listings.
You don't have to be on a page ctrl=product&task=listing to use it. Anywhere you see a products listing of HikaShop that file is used.
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
- Posts: 38
- Thank you received: 2
if(!empty($this->modules)){
$html = '';
jimport('joomla.application.module.helper');
foreach($this->modules as $module){
$html .= JModuleHelper::renderModule($module);
}
if(!empty($html)){
echo '<div class="hikashop_submodules" style="clear:both">dddd'.$html.'dddd</div>';
}
}
And I did not see any product template load, that is why I thought.
Also it is very confusing what it $this->modules and $this->module. At first I thought it is for using this templates when render inside module. But somehow this contain list of products.
It is ok, I know now that I need to edit product/listing_div to correct product list rendering. But when code is clean it simplify work.
Anyway I very appreciate your quick response.
Please Log in or Create an account to join the conversation.
It's just that you an't load a template from another view like that.
In your category listing menus, you have an associated module which is the one displaying the products listing.
And that's why you have these module variables.
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
- Posts: 38
- Thank you received: 2
Actually I cannot understand how it works. Because if I add menu link to Product listing I see no products. Because i do not have products in root category.
I think that category and product listing should be one layout. Like it is in category/listing. But it should show products not through module system but through template system.
But it is ok. It is just opinion one of many. most important that at the end I can do what I need
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
- Posts: 38
- Thank you received: 2
in category/listing I have this
Then it shows
But no matter what i do I cannot forse to show anything. Where do i set additional category information?
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
- Posts: 38
- Thank you received: 2
This code in product/listing gives error. Say that template not found.
Please Log in or Create an account to join the conversation.
Indeed by default, a listing of products menu will display the products in the root category. If you want to change that category or tell the system to display all the products even in sub categories, you need to edit the hikashop options of your menu and change the corresponding options 'parent category' and 'sub elements filter'.
There is no need to change the code to display the products. It's just a matter of configuring your menu (and its associated module if it's a category listing menu).
It's normal that the filter template loading code is not working if you're not using the Business edition as this template is only available in the Business edition.
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
- Posts: 38
- Thank you received: 2
I try to customize hika as download section. And I want i said to show download link right in the list, It is ok and I think I will be able to load files and fetch them.
What I want also that if user already purchased this product, hide price and write "Free download" or "Download Allowed". How to check if this user have had purchased this product with confirmed status?
Please Log in or Create an account to join the conversation.
$query = 'SELECT a.order_id FROM '.hikashop_table('order').' AS a WHERE a.order_user_id='.(int)hikashop_loadUser();
$this->database->setQuery($query);
$order_ids = $this->database->loadResultArray();
if(!empty($order_ids)){
$filters = array('a.file_ref_id='.$products_id,'a.file_type=\'file\'','a.file_id='.$file_id);
$query = 'SELECT a.*,b.* FROM '.hikashop_table('file').' AS a LEFT JOIN '.hikashop_table('download').' AS b ON b.order_id IN ('.implode(',',$order_ids).') AND a.file_id = b.file_id WHERE '.implode(' AND ',$filters);
$this->database->setQuery($query);
$fileData = $this->database->loadObject();
if(!empty($fileData)){
//display link
}
}
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
- Posts: 38
- Thank you received: 2
If I var_dump $this->row I get file information
But in all cases this is reference to thumbnail file not to download one. Should I also make another query to get list of product attached download files? What if I have 3-5 files to download along with one product?
Problem 2
If I make order "confirmed" in backend nothing get into file_download table. How records get there? Why product show Download period elapsed when I just created confirmed order? Any way I cannot manage to allow download file. Even to show it in the product.
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
- Posts: 38
- Thank you received: 2
I get product ids. Then it is easy
The only one thing I cannot solve that file in not downloaded anyway. Probably because order marked confirmed in backend and there is nothing in file_download table.
Please Log in or Create an account to join the conversation.
$query ='SELECT a.* FROM '.hikashop_table('file').' WHERE file_ref_id = '.$product_id.' AND file_type = \'file\';
Your code is great. After that code you should simplify the code I posted and do something like that:
$filters = array('a.file_ref_id='.$this->product_ids,'a.file_type=\'file\'','a.file_id='.$file_id);
$query = 'SELECT a.* FROM '.hikashop_table('file').' AS a WHERE '.implode(' AND ',$filters);
$this->database->setQuery($query);
$fileData = $this->database->loadObject();
because there is no need to make any link between orders and files via the download table since you already did it with your query.
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
- Posts: 38
- Thank you received: 2
I gel links to downland all files. Because some downloads are free. And i index it by product ID. Later in product
Everything works good when I click on free download. But when I click on paid download link it says Order Not Found. I suspected that this is because file_download table is empty. I added there record for order Id and File ID but it did not change anything.
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
- Posts: 38
- Thank you received: 2
Please Log in or Create an account to join the conversation.
You should change a bit the code of that query
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
- Posts: 38
- Thank you received: 2
And in classes/file.php
But you do not pass $order_id in to download method of file. You need to add either
or
Please Log in or Create an account to join the conversation.
In the order controller, there is also a download task which handles both the file_id and the order_id.
It's normal that the product controller's download task only handle file_id as it is used for free downloads only.
Please Log in or Create an account to join the conversation.