Author Topic: show categored products on product detail page  (Read 2464 times)

gpessoa

  • Jr. Member
  • **
  • Posts: 164
show categored products on product detail page
« on: February 27, 2021, 20:47:22 pm »
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 3.9.25; VM 3.4.2; PHP 7.2.34

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1286
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: show categored products on product detail page
« Reply #1 on: February 27, 2021, 21:06:18 pm »
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 from products, orders and database table
Virtuemart Email Manager - customs email templates

gpessoa

  • Jr. Member
  • **
  • Posts: 164
Re: show categored products on product detail page
« Reply #2 on: February 27, 2021, 22:04:56 pm »
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 3.9.25; VM 3.4.2; PHP 7.2.34

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1286
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: show categored products on product detail page
« Reply #3 on: February 28, 2021, 05:32:06 am »
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

Code: [Select]
{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 from products, orders and database table
Virtuemart Email Manager - customs email templates

gpessoa

  • Jr. Member
  • **
  • Posts: 164
Re: show categored products on product detail page
« Reply #4 on: February 28, 2021, 16:31:37 pm »
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 3.9.25; VM 3.4.2; PHP 7.2.34

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1286
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: show categored products on product detail page
« Reply #5 on: February 28, 2021, 18:17:57 pm »
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 from products, orders and database table
Virtuemart Email Manager - customs email templates

gpessoa

  • Jr. Member
  • **
  • Posts: 164
Re: show categored products on product detail page
« Reply #6 on: February 28, 2021, 21:30:04 pm »
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 3.9.25; VM 3.4.2; PHP 7.2.34

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1286
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: show categored products on product detail page
« Reply #7 on: February 28, 2021, 21:53:45 pm »
ok, send me info on skype :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10343
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: show categored products on product detail page
« Reply #8 on: March 01, 2021, 19:28:23 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

gpessoa

  • Jr. Member
  • **
  • Posts: 164
Re: show categored products on product detail page
« Reply #9 on: March 01, 2021, 20:16:00 pm »
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 3.9.25; VM 3.4.2; PHP 7.2.34

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4550
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: show categored products on product detail page
« Reply #10 on: March 02, 2021, 10:39:58 am »
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

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1286
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: show categored products on product detail page
« Reply #11 on: March 02, 2021, 12:05:41 pm »
to patrik:

Quote
Why 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 from products, orders and database table
Virtuemart Email Manager - customs email templates

gpessoa

  • Jr. Member
  • **
  • Posts: 164
Re: show categored products on product detail page
« Reply #12 on: March 02, 2021, 12:54:19 pm »
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:

Code: [Select]
<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 3.9.25; VM 3.4.2; PHP 7.2.34

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1286
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: show categored products on product detail page
« Reply #13 on: March 02, 2021, 16:26:33 pm »
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 from products, orders and database table
Virtuemart Email Manager - customs email templates

gpessoa

  • Jr. Member
  • **
  • Posts: 164
Re: show categored products on product detail page
« Reply #14 on: March 02, 2021, 16:50:58 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 3.9.25; VM 3.4.2; PHP 7.2.34