- Posts: 57
- Thank you received: 2
Place a vote, or comment tab only show to bought
12 years 3 months ago - 12 years 3 months ago #161619
by iwally
Place a vote, or comment tab only show to bought was created by iwally
Hi right now, I have enabled the feature comments and vote, but only for people who bought the product,
when you go to the product page as an user that has not bought the item,
it shows a tab called, place comments.
That tab should only be displayed to a customer who bought it, because now you can click it and its empty, making it look broken
How can I fix this?
Screenshot:
prntscr.com/3w0uif
when you go to the product page as an user that has not bought the item,
it shows a tab called, place comments.
That tab should only be displayed to a customer who bought it, because now you can click it and its empty, making it look broken
How can I fix this?
Screenshot:
prntscr.com/3w0uif
Last edit: 12 years 3 months ago by iwally.
Please Log in or Create an account to join the conversation.
12 years 3 months ago #161707
by Xavier
Replied by Xavier on topic Place a vote, or comment tab only show to bought
Hi,
You will have to edit the view "product / show_tabular" and add an if condition around the tab for the comments like:
You will have to edit the view "product / show_tabular" and add an if condition around the tab for the comments like:
Code:
$purchased = 0;
$config = hikashop_config();
$hikashop_vote_user_id = hikashop_loadUser();
if( !empty($hikashop_vote_user_id)){
$query = 'SELECT order_id FROM '.hikashop_table('order').' WHERE order_user_id = '.$db->quote($hikashop_vote_user_id).'';
$db->setQuery($query);
if(!HIKASHOP_J25){
$order_ids = $db->loadResultArray();
} else {
$order_ids = $db->loadColumn();
}
if(!empty($order_ids)){
$query = 'SELECT order_product_id FROM '.hikashop_table('order_product').' WHERE order_id IN ('.implode(',',$order_ids).') AND product_id = '.(int)$this->row->product_id;
$db->setQuery($query);
$result = $db->loadObjectList();
if(!empty($result))
$purchased = 1;
}
}
if($purchased){
// code which display the tab (the "li").
}
Please Log in or Create an account to join the conversation.
12 years 3 months ago #161790
by iwally
Replied by iwally on topic Place a vote, or comment tab only show to bought
Thanks! I think this should be default in Hikashop though? Right?
For next version?
Please Log in or Create an account to join the conversation.
12 years 3 months ago #161884
by Xavier
Replied by Xavier on topic Place a vote, or comment tab only show to bought
Hi,
We will see, but yes why not integrate this directly in a future version.
We will see, but yes why not integrate this directly in a future version.
The following user(s) said Thank You: iwally
Please Log in or Create an account to join the conversation.
Time to create page: 0.186 seconds