Hide add to cart on Coming Soon

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 8 months ago #330182

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 3.9.24
-- PHP version -- : 7.4

Hi
I have made a category named COMING SOON and a badge that goes with it.
Can I hide the ADD TO CART on products that are in this category?
The products are other categories too ...

If I set the stock to 0 I get the SOLD OUT and that's not the meaning :-)

I tried setting Quantity input method to NONE on the category, but nothing happens.

Regards
Thomas

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
3 years 8 months ago #330190

Hello,

From what you said, I see a solution, use some custom Css to customize your elements WITH a specific selector.
hide unwanted elements in the required context :
.specific_context_class .unwanted_element_html_class {display: none;}

And add some text with this ::after (or ::before) selector :
.specific_context_class .unwanted_element_html_class::after {
content: "your required text";
// text css command :
color : #000;
background-color : #d7d7d7;
}


Note : With this documentation , learn how to add custom css command to your frontend file.

Hope this will help you to achieve what you requested.
Regards

Last edit: 3 years 8 months ago by Philip.

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 8 months ago #330220

Thanks, but the product has no specific selector, just because a badge or category is assigned to it?
Well it does on the product page, but not on a listing page.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 8 months ago #330230

Hi,

Edit the menu item used for your products listing via the Joomla menu manager. There, under the "products options" tab, you'll find a section "product features display" with a setting "badge" that you need to turn on so that the badges will be displayed on the listing of that menu item.

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 8 months ago #330236

Thanks, but I already have the badge visible, the issue is that I need to hide add to cart on items with this badge/category.

Nothing in the code are specific on these items in listings so I can target them with CSS.
The product page has this, so it’s not a problem there.

Makes sense?

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
3 years 8 months ago #330242

Hello,

For built kind of a "restriction" in your css code, we are used to use some specific Class OR Id, product page have a specific container class by Id ;
=> hikashop_product_PRODUCT_CODE_page
OR for Category via a class + id (Category Id)
=> hikashop_product_of_category_ID

Hope this will help you to built a specific selector, and progress on your Css custom.
Regards

Last edit: 3 years 8 months ago by Philip.

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 8 months ago #330283

Thanks, but I don't see any category specific class or ID on an item in a listing?

I need to target the black poster on this page:
tasteofport.dk/shop/plakater

Well the category Coming Soon that has the ID 66.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 8 months ago #330284

Hi,

You have this id which is unique to this product:
div_hikashop_category_information_module__491
So you can add such CSS:
#div_hikashop_category_information_module__491 .addtocart_wrap { display: none; }
and it will hide only the add to cart of the black poster product.
And similarily, you have this class hikashop_product_listing_61 in a div which encompasses all the products of that listing and which contains the id of the current category so that you can target all the products of that category.

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 8 months ago #330304

Thanks ...
So I can't do what I want to do: target all products that are placed within the COMING SOON category.
Only the black poster is in that category on that listing, so hikashop_product_listing_61 can't be used.

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 8 months ago #330305

It seems I need to get something like this:

$classes = array();
if(!empty($this->categories)) {
foreach($this->categories as $category) {
$classes[] = 'hikashop_product_of_category_'.$category->category_id;
}
}

<?php echo implode(' ',$classes); ?>


added to product / listing_img_title.php, but how?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 8 months ago #330307

Hi,

The categories of each product are not loaded on the products listings.
So you would first have to run a MySQL query on the hikashop_product_category table for each product to load the ids of the categories. And only then, you would be able to have such code and add the implode in the class attribute of this div :

<div class="hikashop_listing_img_title" id="div_<?php echo $mainDivName.'_'.$this->row->product_id;  ?>">

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 8 months ago #330327

Thanks Nicolas

I'll find a developer to help me with that :-)

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

  • Posts: 359
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 8 months ago #330337

Here's the solution, if any other need this:

$classes = array();
if(!empty($this->row->categories)) {
foreach($this->row->categories as $category) {
$classes[] = 'hikashop_product_of_category_'.$category->category_id;
}
}

And then:
<?php echo implode(' ',$classes); ?>

The following user(s) said Thank You: nicolas

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

Time to create page: 0.088 seconds
Powered by Kunena Forum