News:

Support the VirtueMart project and become a member

Main Menu

Product page, show modules from canonical link.

Started by EvanGR, February 05, 2021, 09:33:32 AM

Previous topic - Next topic

EvanGR

The problem in short:

We have assigned Joomla modules to appear in the product page (different for each product category).
Because a product can be accessed by multiple URL variations, the modules do not always appear to the customer (unless they land on the canonical SEO link of the product).

I am looking for code logic for the product page template, that goes something like this:
"Gather what Joomla modules are assigned for the canonical link for this product, for X module position, and show them here"

Makes sense?

The objective is: Whatever link the customer uses to view a product, even if it is the raw virtuemart link with the the URL parameters, show the modules designated for its product category (module menu assignment).

This is very important because the customer often misses essential informational and marketing modules that target each product category.

Thanks!




Jörgen

I can recommend a component from regular labs, that could help You out, this has a lot of possibilities. I think it is very neat. You could set up one omdule as "pattern" for others to follow, makes it easier to maintain.

https://regularlabs.com/extensions/advancedmodulemanager

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

pinochico

advancedmodulemanager is basic for 10 years for us :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

EvanGR

I use it too! The free version.

But assigning modules by "Menu" doesn't work, if you view the product via a different link (e.g. the raw virtuemart URL: /index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=7&virtuemart_product_id=75937&Itemid=386)


Jörgen

Assigning by meny works without this component. Please check out the other possibilities the module offers. You can assign VM categories and VM products. But You have to do it Yourself, it is not magic.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

pinochico

We use pro version

As said Jörgen, for add module to product detail you can try other option - assign to VM product.

Or you can use other option - we use our two modules:
- easyslideshow articles
- virtuemart product extended

and in both we developped connection for exactly VM product and next we use module position - product-detail and next we use component modeleadvanced pro and setup only for VM product assign.

You can see on our lot of shops :)

The same solutions you can use too, only change product to category
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

PRO

why not create a dynamic module position BY category ID


$jinput = JFactory::getApplication()->input;
$catid = $jinput->getVar('virtuemart_category_id', '0');

<jdoc:include type="modules" name="cat<?php echo $catid ?>" style="style_name" />

Then in your module just type in the module position with the cat number behind test.

like cat123

EvanGR

I did not know Advanced Module Manager allowed to assign by VM product/category! (I use the free version)

@PRO
That's the solution I went for, you are awesome!
I only slightly modified the code to get the canonical category id.

$productCategoryId = $this->product->product_canon_category_id;

Thank you everyone for helping! Great input from everyone!