Magento Styling Products in a Particular Category - css

In Magento, how would I be able to treat products in a particular category differently?
Lets say, I have one category "Specials" and I want to have a bit different presentation of its products from the rest of the catalog products.
I initially thought about hooking custom styles up to the category class name that gets attached to BODY element. That, however, does not seem to be fool-proof, since if you directly access those products, they dont always show up as in that category (assuming cookies or sessions have a say in this) and custom styling is ignored.
Also though about assigning custom layout template to that category, but I am using those as layouts and not styles and I dont want to mix up the uses to avoid issues in the future.
Anyone had this concern before? Thanks for the help!

You have 2 code oriented solutions :
If the notion of "category" is the fact that you're accessing a product through a category (on your product page, the breadcrumb display the category), you'll be able to cehck (somewhere in your catalog/product/view.phtml) the Mage::registry('current_category') which contains your current_category and compare it with your "particular category" (which could be stored as a configration variable)
Otherwise, if you want your style applied even when you're not accessing your product via the category navigation, you'll have to manually check your product categories ($product->getCategoryIds()) and compare it with your "particular category" (which could be stored as a configration variable)
ps: keep in mind that a product can be assigned to multiple categories
Hops this helps you

If you have particular category like special so Create new theme for Only Special category and assign that theme to special category from backend, you can easily assign different theme to different category from category management page in admin.
Or you can aslo assign different theme to products also from manage products page.

Related

Wordpress different products category pages with different widgets

I am making this wordpress based website ( https://naujas.pacopac.lt/ ), it is for company with multiply product categories and in every category page I want to have filter system by different attributes.
I tried to create page for every category, but the problem is that I can add products of certain category, but I can not filter them then. Also I can only add filtering through widget.
So the way i see to make it is by directing people to product category page, like https://naujas.pacopac.lt/product-category/“name of category”/. For example https://naujas.pacopac.lt/product-category/pakuotes/ , add widget with filtering and then it works. BUT every category has to be filtered with different attributes, and I am only able to add one same widget to all categories pages and I can not find a way in WordPress to edit every each of these category pages, also I can only make one side widget.

So in short the problem is, how can I make different Side widgets and edit every each of product category pages with different widgets? I am using uncode theme with woocommerce and visual composer, would like to avoid coding, but also have basic knowledge in it so something not too complicated could be done.

Thank you very much guys!
Solved with Widget Logic plugin, able to show widgets on certain pages and hide others

How can I build WooCommerce products collections?

I want to build products collections similar to AliExpress,Amazon, Etsy and other collections.
I can suggest you three ways:
You could create new taxonomy called collections, each term would be a collection. You can extend it for your needs by adding custom fields to collection taxonomy terms i.e. image, relations with specific brands ( which also can be created as taxonomy ).
To make final render adjustments, you will have to override archive.php template for your collection taxonomy - i.e. taxonomy-collection.php or taxonomy-collections.php ( depending on slug you choose to use )
You could create new custom post type collections, and then create for product post type additional custom field, that would list in dropdown ( multiselect ) or multiple checkboxes all collections.
You will then need to override single.php template for single custom post type view, i.e. single-collection.php
See: https://developer.wordpress.org/themes/basics/template-hierarchy/ for templates reference.
You could find and install some plugin ( there is a decent number of such ) that offer extending WooCommerce in terms of having brands and collections attached.
I would suggest first approach, or second if you are decent in WordPress and WooCommerce development. Third is at first easiest, but usually lacks of flexibility and customization, since it is not your code.
Wouldn't Grouped products work for you (or anyone searching here)?
https://docs.woocommerce.com/document/managing-products/#section-12
Go to: WooCommerce > Products > Add New.
Enter a Title for the Grouped product, e.g., Back to School set
Scroll down to Product Data and select Grouped from the dropdown. The price and several other fields disappear. This is normal because a
Grouped Product is a collection of ‘child products’, which is where
you add this information.
Publish.
The Grouped product is still an empty group. To this Grouped product,
you need to:
-Create products and add them
-Add existing child products
If you are looking to make collections like those in shopify, for example, grouping products by attributes, or a certain word contained in the title. There is a plugin called WooCommerce Collection by WooExperts. Unfortunately it is a paid plugin. I will give the link below to avoid confusion with another plugin called WooCommerce Collections.
I am not in anyway affiliated to them, I simply use it and it solved this issue for me.
Here is the link: https://wooexperts.com/plugins/woocommerce-collection/

What's the best the approach to add an extra attribute field in Drupal Commerce?

I'm using Drupal Commerce and i have a product type called "Painting" this product type does not have an attribute fields, I'm using inline_entity_form module so i can show the product add form within the node add form for my product display content type.
The product in the site is the painting itself, it may come with a frame or without a frame (the user can choose) and the price will change based on the user's choice, how can i add such field without using attributes fields? as attributes fields requires that the site admin to add many products and put them in one product display, i just want to keep it simple to the site admin, to make him add the product in the same way he adds a node.
Thank you.
This sounds like you just need two variations:
Product one, without frame
Product two, with frame
Each variation has it's own price and title.
You can get by without using an attribute field. Drupal Commerce renders a dropdown when there are no attributes and allows user's to pick from the product variation titles. Since you are using Inline Entity Form this should be seamless for the site admin.

Drupal dynamic product catalog (without commerce)

So, I work at a web development agency and we recently decided to give our custom CMS up and start developing with Drupal. Currently, I am developing a wholesale product website. What I need to do is to create some product catalogs without using commerce since we do not need the purchase, checkout and payment features and I thought that using the built-in Content, Taxonomy and Views features we can get our job done.
I have created the product categories in Taxonomy. The main (root) categories are main Taxonomy objects and the subcategories are terms.
I created a custom Content type called: products. In this type I have the following form fields: Product Code, Name, Image, Description and a list field to choose the Terms I would like the product to be displayed in.
I would appreciate some help in order to set the whole structure up as I am still heavily influenced by the custom CMS we used to work on that had similar content management with Joomla!
In conclusion, I would like to:
Set a sidebar menu up that contains the categories and the subcategories as a tree. I would also like the menu to be updated if any changes occur in the taxonomy (e.g I add a term in taxonomy and it shows up on the menu).
Set the structure so that when someone clicks on a category that does NOT contain products but subcategories, gets the list of the categories bellow the active one.
I am really looking forward to your answers and I'd like to thank you in advance.
You could give a try to a combination of Taxonomy Menu and Menu Block modules. Taxonomy Menu allows you to easily generate menus from taxonomy vocabularies, and Menu Block creates menus and "menus portion", for instance, from level 2 to 3 from a specific point.
So basically, you can create menus from taxonomy and then create submenus from those menus with Menu Block. It can be tricky but you can do a lot of things with these modules.
Good luck

Woocommerce: Can I share category properties across products?

I am looking for a way to share properties over different products which belong to the same category.
Let me explain:
I have a couple of products which share the same properties, but the color. To avoid entering data over and over, I'd like to add common properties to their category and show these properties as a part of the product-details.
Example:
Let's say I have 'wireless headphones': They have different colors, sizes, etc... but they also share lots of identical properties. They're not product variations, but different products of the same kind.
Is there a way to add common properties of this category (e.g. 'stereo', 'wireless', 'frequency') to a single-product page?
Right now I am loading this data via Javascript from a .html template after the browser loaded the product. Works fine, but I guess there must be a better way, so I can handle these properties from within WooCommerce.
Any info/hint/pointer appreciated
This is what Attributes are used for. Once you have your Attributes setup when you go into a product you can add the attribute that you are looking. This video should help https://www.youtube.com/watch?v=7PX8MWBOAeo

Resources