How can I build WooCommerce products collections? - wordpress

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/

Related

Connect one CPT to another CPT in a wp_query loop

I am looking for the most efficient way to create two separate custom post types called "venues" and "offers". The role of such would be to display on a website it in the following way:
VENUE_1
offer A
offer B
etc
VENUE_2
offer C
As you see, the venues will be quite static, once added photos and descriptions will remain the same. The most dynamic thing are offers. They will vary from each other. I know I can handle that through ACF repeater in a single CPT but I don't want to use this solution due to a few technical requirements.
Is there any way that Wordpress (or Wordpress +ACF) will allow to do that? From the flow pov it will look like that:
an editor adds venue, with descriptions, photos etc through venue CPT
along the time an editor adds specific offers through offers CPT, selecting via e.g. dropdown to which venue it is connected
I have never used relationship fields in ACF but afaik while selecting I need to do it fully manually and select very specific offer. And as said, I want to handle later on only offers, avoiding situation when constantly I need to add manually those via venue item.
You're probably over complicating things.
You should approach it from a taxonomy point of view, meaning,
venue as a taxonomy, offer as a custom post type.
You can use taxonomy-<my-taxonomy>.php to create a specific template for your custom taxonomy. eg: taxonomy-venue.php.
You will be able to access your venue through the following permalink example.com/venue/my-awsome-venue
On each venue taxonomy pages you will a custom query to loop through each offer which are listed under the currently queried venue.
You should read Template Hierarchy from the codex, to have a better understanding of templating.

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.

Magento Styling Products in a Particular Category

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.

Wordpress: Using Custom Post Type for image list of Product

I have a Wordpress-blog with gift ideas where I write text based articles. I recently discovered Custom Post types which I believe is the solution to an feature I want to create.
What I want:
Be able to tag each custom post using the normal "Categories" and "Tags".
Create a 3x3 matrix with product images (custom posts) to be shown on top of each Category-view or Tag-view (followed by the typical article list in the category or tag).
Example:
Lets say I have a category "Gifts for mom" and tags "Pink", "Cheap"
In the category "Gifts for mom" I have 10 text articles (normal posts) discussing the difficulties of buying gifts for your mom
I create nine custom posts, each is a specific gift (e.g. A pink hairbrush). I want to place them in the Category "Gifts for mom" and tag them with "Pink".
When I view myrandomgiftblogname.com/category/gifts-for-mom I want to be able to get a view:
Gifts for mom
Product Product Product
Product Product Product
Product Product Product
Articles:
- This awesome article
- That awesome article
- Etc
I assume this is possible but don't really know where to begin. Could you point me in the right direction? Which Plugins do I need? Do I need to do any programming myself (or just plugin configuration)? Is this even possible?
The description is a bit broad, hence a bit broad answer.
Two things are needed:
1) A plugin to create the Custom Post Type.
It is considered best practice to let CPT's in Plugin territory. So you can swap designs and preserve your CPT functionality. In reality, you are asking for future problems letting this be handled by the theme.
Create your own plugin, which would contain a register_post_type and any extra configs.
Use an existent plugin, like Custom Content Type Manager.
Its Custom Fields features are quite handy as well.
Allows users to create custom content types (also known as post types) and standardized custom fields for each, including dropdowns, checkboxes, and images.
2) Learn how to use and customize WordPress Templates
http://codex.wordpress.org/Templates
Templates are the files which control how your WordPress site will be displayed on the Web. These files draw information from your WordPress MySQL database and generate the HTML code which is sent to the web browser. Through its powerful Theme system, WordPress allows you to define as few or as many Templates as you like all under one Theme. Each of these Template files can be configured for use under specific situations.
You can try the following:
Add a new Page for each category with the exact same name as the category.
In the Images menu attach to each of those pages the images you want.
In your script query for a page with a name identical to the current category, and pull all of its attachments

Using WordPress Content Item as a Taxonomy

Is there a way (or a plugin) to make a given content type in WordPress (i.e. posts, pages, media, custom post types) act as a taxonomy? I basically want to setup a one-to-many relationship of one item in a given post type to many items of a different type.
So basically, I have a custom post type, call it Authors. I want to use a Post Type rather than a taxonomy because I need a lot more meta data than a taxonomy allows.
I then have another custom post type called Books.
Is there a way to put a box similar to the Categories or Tags metaboxes on the Author write page that display a list of all the books. I can then choose from a list of all the books, thus creating a relationship.
If this doesn't already exist, I guess I'll write a plugin for it. I thought I'd give this a try first, just in case.
Have you considered adding new meta fields to a custom taxonomy? Unfortunately, you ned to either create a new table for the meta storage or use wp_options, but it does work and is relatively future-friendly. Remember to start your option names with an underscore, though.
http://www.strangework.com/2010/07/01/how-to-save-taxonomy-meta-data-as-an-options-array-in-wordpress/

Resources