News:

Looking for documentation? Take a look on our wiki

Main Menu

show categored products on product detail page

Started by gpessoa, February 27, 2021, 20:47:22 PM

Previous topic - Next topic

gpessoa

Hi ppl
I want to show categored products on product detail page...
I already create a few unpublished categories and  assembled a products to them...
Created a module to show de products and added it to the category (Modules Anywhere)
Now, please, I need, a cut and past code to add to my product detail template in order to call unpublished categories, filter by assigned products...
Can someone help me?
Thanks in advanced!
J 4.4.4; VM 4.2.6; PHP 8.3.6

pinochico

I don;t understand really, but if you need show module on prouctdetail you can do it step by step by tutorial:
https://regularlabs.com/extensions/modulesanywhere/tutorial
and add module inside productdetail.php layout in your template override.

And the best option is use with togetther https://regularlabs.com/extensions/advancedmodulemanager and setup "show on product detail"
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

gpessoa

#2
I already use "Modules anywhere" and was this that I already set up on my umpublished categories!

The idea is to have this categories to show product related colours...
and, by clicking on it, the product changes to selected one!

I don't use custom fields, as they are very difficult to handle with CSVI.
J 4.4.4; VM 4.2.6; PHP 8.3.6

pinochico

I am not a native speaker of English.
Unfortunately, if you use exclamation points ("!"), my google translate will not improve and will not translate what you thinking - but I accept your apology :D.
Attaching images is much better and it fully complies with the rules for creating a request on this forum.

I can imagine that using CSVImproved can be a bit difficult to import parameters (I've been using it since VM1), but for the whole functionality of the e-shop for customers, the use of customfields is much better.
Because customers don't want to create many clicks and redirects, they want information right away - you'll know in GA how long a customer stays on one page - if they don't buy by then, they're going to another e-shop.

Therefore, for choosing a color variant, it is best if the price, main picture, description and the product itself change in real time (ajax) on the product detail using custom files or using child products and the customer is not redirected anywhere.
There are many ways to do this, described here on the forum or in the virtuemart documentation and you can also find them on the virtuemart demo (of course there is no product display using an image, but a dropdown - but even so it is still a much better option to create an eshop, because the main image you can change in real time and your customers will be grateful).

Or, you can display color variants as related products and move the code for related products in the product detail template and place it in the productdetail.php template after the sublayout price.php to match your image.

But I can also imagine that you want to display products as your idea and display color variants using your displaying products from the non published category.

Then what I wrote earlier is that after sublayout price.php you place the code to display the module for displaying products from the category (I assume you use the virtuemart product module) according to the documentation on RegularLabs - generally something like

{module 241}

Try and test the final solution self pls.

Or you can use a paid extension (breakdesign.com, shop42.fr) to display the required information.
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

gpessoa

#4
Using unpublished categories (for me) is the best way as it shows every detail of the selected product (stock, maybe different related products or a popup, etc)
and to manage it, you only have to assign the category to the desire product on your local DB, and let CSVI do the rest....
also, when a product is unpublished, it automatically disappear from it, means zero work.

About display a module in product details template:
It can't be done that way, unless I create a different template override to each one hidden category, and they are a lot (more than 100).... and then assign each one to the respective products.

Maybe the best way is create a sublayout (related-colours.php) to do this, without modules.
J 4.4.4; VM 4.2.6; PHP 8.3.6

pinochico

#5
If I had to deal with this at the customer's e-shop and wanted to use the display of products from the unpulled category on the product detail,
I would use the virtuemart product extended module, add a condition for displaying products from an unpublished category and then for each product I would enter the ID of the unpublished category in the administration with a customfield.

So the module would load me only those products that I want to display on the product detail and which would be from the relevant unpublished category.

But it would mean:
- add products to an unpublished category
- create unpublished categories
- add an unpublished category ID to each product using a customfield
- using PHP directly in the file productdetail.php or using the module Virtuemart Product Extended to complete the condition for displaying products from the category

Isn't it a lot of work as opposed to a solution if I used related products?
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

gpessoa

That's almost what I asked for on my initial post.
The only thing I don't want is using custom fields...

So, to do this I only need a condition php code to echo {module related-colours}
Something like:

<div class="related-colours">
  <?php //shows related unpublished category products

php code with a Condition to relevant unpublished category where the product is assigned, to show below module.


  {module related-colours}
  ?>
</div>

J 4.4.4; VM 4.2.6; PHP 8.3.6

pinochico

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

GJC Web Design

try


<?php
if (VmConfig::get('category', 0) == 0) {   
if (!empty($this->product->category)){   

echo '{module related-colours}';

}
}
?>

though I haven't read the whole thread at least this syntax is correct
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

gpessoa

It doesn't filter properly!
it shows the products on the category you are in , even on the product that doesn't have any unpublished category assigned!
Should be only products from the assigned unpublished category.
J 4.4.4; VM 4.2.6; PHP 8.3.6

Studio 42

Why aren't you using the child variants?
For more complex case, i have this product customfield plugin in my shop https://shop.st42.fr/en/products/extra-product.htm

pinochico

to patrik:

QuoteWhy aren't you using the child variants?

I think I send recommendation about child product:
http://forum.virtuemart.net/index.php?topic=146401.msg520912#msg520912
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

gpessoa

#12
I don't use Childs and I don't want to change my all structure to do this...

About extra products, It looks like a cross selling, it seems a good future for later analyses and update!

Now, I just need a php help to created relationship between products and unpublished category this products are in!
So far, I get this:

<div class="related-colours">
<?php //shows related colours by unpublished category products
if (VmConfig::get('category'0) == 0) {   
if (!empty(
$this->product->category)){   

 echo 
'{module related-colours}';

}
}
?>


it gives me the related products from the category you are in,
but I need it to be from the unpublished category that the product belongs!
and also, if there are no unpublished category shows nothing.

EDITED:
now, I need it to be from the last category tree that the product belongs!
J 4.4.4; VM 4.2.6; PHP 8.3.6

pinochico

we are connected by skype and

I figured out how to do it, I just need to check it out and we agreed to look into it on Thursday as part of paid support, because the work schedule for this week has already been created and I have to serve many clients every day and they are waiting for corrections and results - I can't be a "friend on the phone" for everyone (as in the American game "risk is profit" - when someone calls and I quit my job and devote myself to it immediately).

And yes, we know about it, we won't use children to not have to redo the whole eshop.
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

gpessoa

Quote from: pinochico on March 02, 2021, 16:26:33 PM
we are connected by skype and

yes, we are ...
to know if your module does the job without any change!
but, if it doesn't, I need other solution...
J 4.4.4; VM 4.2.6; PHP 8.3.6