News:

Support the VirtueMart project and become a member

Main Menu

How to add custom html in product detalis to all product in category

Started by djgorandj, February 25, 2021, 12:12:39 PM

Previous topic - Next topic

djgorandj

Need me insert popup images in product details like this picture, and add to all product in selected category? Any solution, tax have this options to assign to all product in category.

ps
my solution working bt need insert separatly custom fields to all product, lost time to add this.

Jörgen

Create hidden parent product, insert the neccessary custum fields in parent. Child products inherit custom fileds etc from parent.

Add simply parent id in child product, connnection done.

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

djgorandj

Good idea, any another solution like tax add to specific group?

pinochico

Quotereate hidden parent product, insert the neccessary custum fields in parent. Child products inherit custom fileds etc from parent.

is it practical?


For add table for product detail from exactly category we use little change in PHP for product detail template in template override:
- first check category ID
- second - if category id is exactly from the list of defined categories == I will display my own html

something like

// #14663 - Condition for displaying tabs for category Wheels - https://crm.minion.cz/issues/14663
// HACK START - Ruda : for web kolo-park.cz
$category_tmp = '';
$class_tmp = '';
$category_kola = '742';
$category_elektrokola = '746';

$active_product_id = JRequest::getInt('virtuemart_product_id', 0);
$active_category_id = JRequest::getInt('virtuemart_category_id', 0);

$query = "SELECT virtuemart_category_id, virtuemart_product_id FROM #__virtuemart_product_categories WHERE virtuemart_product_id = " . $active_product_id;
//$db->setQuery($query);
$db = JFactory::getDBO();
$db->setQuery($query);
$categories = $db->loadObjectList();

foreach ($categories as $category) {
    if (($category->virtuemart_category_id == $category_kola) || ($category->virtuemart_category_id == $category_elektrokola)) {
        $category_tmp = $category->virtuemart_category_id;
        $class_tmp = " kola-tabs";
    }
}
// HACK END - Ruda : for web kolo-park.cz


if (($category_tmp == $category_kola) || ($category_tmp == $category_elektrokola)) {
   XXXXX - your html table
}
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