- Posts: 15
- Thank you received: 0
Category displays price when variants are present
- keithyoung89
-
Topic Author
- Offline
Less
More
13 years 11 months ago #71690
by keithyoung89
Category displays price when variants are present was created by keithyoung89
The shop has a product, within a sub-category, that has 2 characteristics (size and style) and variants - price (per size) and quantity (per style). The main product has no price defined, price being defined by variant. However, when the sub-category to which the product belongs is displayed, it shows a price of '£20 each' (the lowest price defined by variant). This is misleading, as the price is variant depending on size. How can I prevent the display of the price when the sub-category is displayed? Please see the image attached - the '£20 each' should not be there. Thanks.
Please Log in or Create an account to join the conversation.
13 years 11 months ago #71863
by Xavier
Replied by Xavier on topic Re: Category displays price when variants are present
Hi,
One solution could be to create a custom field on the table product and with the label "displayprice" in HikaShop > Display > Custom fields, then edit the view "product / listing_img_title" in HikaShop > Display > Views.
In this view replace the code:
By:
Then in the product edition page, just set "no" in the custom field for the products with variants.
One solution could be to create a custom field on the table product and with the label "displayprice" in HikaShop > Display > Custom fields, then edit the view "product / listing_img_title" in HikaShop > Display > Views.
In this view replace the code:
Code:
if($this->params->get('show_price','-1')=='-1'){
$config =& hikashop_config();
$this->params->set('show_price',$config->get('show_price'));
}
if($this->params->get('show_price')){
$this->setLayout('listing_price');
echo $this->loadTemplate();
}
By:
Code:
if(isset($this->row->displayprice) && $this->row->displayprice == 'no'){
if($this->params->get('show_price','-1')=='-1'){
$config =& hikashop_config();
$this->params->set('show_price',$config->get('show_price'));
}
if($this->params->get('show_price')){
$this->setLayout('listing_price');
echo $this->loadTemplate();
}
}
Then in the product edition page, just set "no" in the custom field for the products with variants.
Please Log in or Create an account to join the conversation.
- keithyoung89
-
Topic Author
- Offline
Less
More
- Posts: 15
- Thank you received: 0
13 years 11 months ago #71933
by keithyoung89
Replied by keithyoung89 on topic Re: Category displays price when variants are present
Thanks - I'll try this in the next day or two. It does seem a bit user-unfriendly to need to amend core code to overcome what seems to be a flaw in the system. Perhaps you could take this on board for future versions? I'll report back on how I get on with your solution.
Please Log in or Create an account to join the conversation.
- keithyoung89
-
Topic Author
- Offline
Less
More
- Posts: 15
- Thank you received: 0
13 years 11 months ago #71973
by keithyoung89
Replied by keithyoung89 on topic Re: Category displays price when variants are present
I am unable to add a custom field to table 'product' via back-end: if I click New, the table selected is Address and is not a drop-down menu to be able to select Product table. So, I tried adding the new field via phpmyAdmin (displayprice, varchar(255)). I amended the code in listing_img_title as you specify (do you need 2 curly brackets at the end of the revised code?) However, I don't see anywhere the new field to input 'no' - what do you mean by the 'product edition'? I assume you mean the page to create/amend product details? Thanks
Please Log in or Create an account to join the conversation.
13 years 11 months ago #71994
by nicolas
Replied by nicolas on topic Re: Category displays price when variants are present
The "table" dropdown is only available in commercial editions of HikaShop. You must be using the Starter edition which does not allow for that.
You can't just add the field via the database as it's more complex to do.
You can't just add the field via the database as it's more complex to do.
Please Log in or Create an account to join the conversation.
- keithyoung89
-
Topic Author
- Offline
Less
More
- Posts: 15
- Thank you received: 0
13 years 11 months ago - 13 years 11 months ago #72107
by keithyoung89
Replied by keithyoung89 on topic Re: Category displays price when variants are present
Yes, I'm using the Starter edition, so I guess this solution can not now be applied.
Last edit: 13 years 11 months ago by keithyoung89. Reason: I confused the issue!
Please Log in or Create an account to join the conversation.
Time to create page: 0.314 seconds