Can badges appear on items in product listings?

  • Posts: 40
  • Thank you received: 1
11 years 11 months ago #81526

Hi -

I've created an unpublished category to allow a 'SOLD' badge to be added to a product image after the product has been purchased, so that the item can remain on display for a while. The 'SOLD' badge appears on the product page as expected, but not on the entry in the product listing - is this because the original category/product entry, without the badge overlaid, takes precedence?

Is that correct, or am I doing something wrong? The 'SOLD' items are still also included in their original categories. Is it possible for the badge appear on the item in the original product listing as well as on the product page?

And once a product has been placed in the 'SOLD' category, is it possible to hide the 'Add to Cart' button on the product page, or disable it with a warning message?

Thanks.

Last edit: 11 years 11 months ago by badcoder.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 11 months ago #81635

Hi,

The badges should be displayed in the sold category and in their original category. Do you have the latest version of hikaShop ?

To hide the 'Add to Cart' button you can edit the view "product / show_default" and add a check on the product categories, if the product is in the sold category then hide the add to cart button.

You can find other topics talking about that in this forum.

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 1
11 years 11 months ago #81681

Hi -

No, the 'SOLD' badge only appears on the product page and not on the listing. I have just downloaded and re-installed HikaShop to ensure I have the latest version but it has made no difference. Any other ideas?

Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 11 months ago #81809

Hi,

Could you give us a screenshot of your badge configuration and you product configuration ?
I tried to reproduce the same error on my end, but it's working fine for me.

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 1
11 years 10 months ago #83035

Sorry for the delay in replying, but I still cannot get the 'SOLD' badge to appear on the product listing - below are screenshots of the configuration of the badge item and the product page and product listing. I have created a 'SOLD' category to which sold products are added







So you can see that the badge appears OK on the product page but not on the product listing.

Thanks for your help.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82796
  • Thank you received: 13357
  • MODERATOR
11 years 10 months ago #83232

That should work though.

Maybe you had edited one of the view files of the view "product" before updating Hikashop and thus you didn't get the modifications needed to have the badges on the listings. You should check the product view files via the menu Display->Views for such customization and try to delete it to see if that helps.
If that's not the issue, we'll need a link to that listing page to see what's going on. It might well be some issue with the CSS of your template.

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 1
11 years 10 months ago #84935

I've worked through all the 'view' files that I've modified and updated them. Since updating the views 'product / listing_img_title.php' and 'product / listing_price.php' and then putting back my revisions, the badge displays as expected on both listing and item page.

To hide the 'Add to Cart' button you can edit the view "product / show_default" and add a check on the product categories, if the product is in the sold category then hide the add to cart button.

You can find other topics talking about that in this forum.


Haven't yet found any forum topics about disabling the 'Add to cart' button, so can you help with that please?

Thanks.

Last edit: 11 years 10 months ago by badcoder.

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 1
11 years 10 months ago #84967

OK, I think I've found a post here which details what I want to do, ie. hide the 'Add to cart' button when an item has been sold.

At the moment, the Sold Item category is just a product list whic has no menu item or module because it doesn't display in its own right, simply adds the 'SOLD' badge to items which are added to that category as well as their original category. Once an item is included in the 'Sold Item' category, I want the 'Add to cart' button to be hidden so that items cannot be sold again.

The linked post suggests that the button should be enabled on the front end default configuration, and then disabled on the module linked to the category of the sold item - should I set up a module for the 'Sold items' category, just to hide the 'Add to' button, or is there a simpler way?

Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #85005

Hi,

Your case is different, because you want to hide the add to cart button only on some products in the listing.
You have to edit the view "product / listing_img_title" (or another one depending on your configuration) and add a check aroud the "add to cart" button part to hide it if the product is in the category with the id ...

Try to replace:

<!-- ADD TO CART BUTTON AREA -->
<?php
if($this->params->get('add_to_cart') || $this->params->get('add_to_wishlist')){
	$this->setLayout('add_to_cart_listing');
	echo $this->loadTemplate();
}?>
<!-- EO ADD TO CART BUTTON AREA -->
By:
<!-- ADD TO CART BUTTON AREA -->
<?php
$productClass = hikashop_get('class.product');
$categories = $productClass->getCategories($this->row->product_id);
$hide = 0;
foreach($categories as $category){
	if($category == '13') $hide = 1;
}
if(($this->params->get('add_to_cart') || $this->params->get('add_to_wishlist')) && $hide == 0){
	$this->setLayout('add_to_cart_listing');
	echo $this->loadTemplate();
}?>
<!-- EO ADD TO CART BUTTON AREA -->
Replace "13" by the id of your SOLD category.

Last edit: 11 years 10 months ago by Xavier.

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 1
11 years 10 months ago #85311

Thanks for that, Xavier, the additional code works but only hides the button in the product listing. The 'Add to cart' button still displays on the product page. Do I need to apply the same code to a different view to change the product page?

Thanks for your help.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #85369

Yes you have to edit the view "product / show_default" to hide the add to cart button in the product page.

The following user(s) said Thank You: badcoder

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 1
11 years 10 months ago #85435

Thank you Xavier!

I've substituted the code you gave above for the existing 'Add to cart' section in "product / show_default" and it works perfectly. Thanks again.

Last edit: 11 years 10 months ago by badcoder.

Please Log in or Create an account to join the conversation.

Time to create page: 0.105 seconds
Powered by Kunena Forum