Post by info@julux.ch » Wed Apr 26, 2017 2:11 am

Hi,
i want to replace each producttitle with the categoryname which the product is placed.

This means:
as example I have the following category :
Cars->Seats-->Leather
Cars->Seats-->Other


Now I want to rename each product with the deepest categorytitle
In Category Leather -> All products has the title "Leather"
In Category Other -> All products has the title "Other"
In Category Seats -> Products has the title "Leather" OR "Other"

I hope you understand what I Need.

can everyone help me?

thanks

Newbie

Posts

Joined
Wed Apr 26, 2017 2:01 am

Post by IP_CAM » Wed Apr 26, 2017 3:51 am

well, understanding = yes, but it still makes no sense to me. How would you want someone
to search for a Product, just to 'END' on a Page, then carrying a different product title ! :-\
But anyway, it's your problem, not mine. But since you did not even bother to mention your Version,
I make it only rudimentary, this one works with my latest TestShop,
and you have to find out for yourself, how to make it work with yours :-*

Good Luck ! :D
Ernie
---
(Slightly modified v.1.5.6.5 Bootstrap Theme Product Title mover XML, the Language Section could even be removed... ;) )
replace_product_title.vqmod.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
<id><![CDATA[Replace Product Title with Category Title]]></id>
<version><![CDATA[OS v.1.5.6.5]]></version>
<vqmver><![CDATA[2.4.1]]></vqmver>
<author><![CDATA[Ernie - IP_CAM]]></author>

<file name="catalog/view/theme/*/template/product/product.tpl">
<operation error="log">
<search position="replace"><![CDATA[<h1 itemprop="name"><?php echo $heading_title; ?></h1>]]></search>
<add><![CDATA[
	<h2 itemprop="name">
	<?php 
	$productcategories = null;
	foreach ($catprod as $catp) { 
	$productcategories = $catp['text'];
	}
	echo rtrim($productcategories, "| ");
	?>
	</h2>
]]></add>
</operation>

<operation error="log">
<search position="before"><![CDATA[<ul class="nav nav-tabs">]]></search>
<add><![CDATA[
	<h2><?php echo $heading_title; ?></h2>
]]></add>
</operation>
</file>

<file name="catalog/language/*/product/product.php"> 
<operation error="log">
<search position="before"><![CDATA[$_['text_model']]]></search>
<add><![CDATA[
	$_['text_productcategories'] = 'Category:';
]]></add>
</operation>
</file>

<file name="catalog/controller/product/product.php">
<operation error="log">
<search position="after"><![CDATA[$this->load->model('catalog/product');]]></search>
<add><![CDATA[
	$this->data['text_productcategories'] = $this->language->get('text_productcategories');
	$this->load->model('catalog/category');
	$this->data['catprod'] = array();
	$product_category = $this->model_catalog_product->getCategories($product_id);
	foreach ($product_category as $prodcat) {
	$category_info = $this->model_catalog_category->getCategory($prodcat['category_id']);
	if ($category_info) {
		$this->data['catprod'][] = array(
		'text' => $category_info['name'],
		'href' => $this->url->link('product/category', 'path=' . $category_info['category_id'])
		);
	}
	}
]]></add>
</operation>
</file>
</modification>
----
Image

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by paulfeakins » Wed Apr 26, 2017 7:00 pm

It sounds like you need a developer to write you a script to do this.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: No registered users and 284 guests