Post by Lef » Fri Jul 11, 2014 4:07 pm

Can anybody help how to add the store name with a link to the store on the product page for a multistore installation?

thank you in advance

Lef
Newbie

Posts

Joined
Tue Jun 19, 2012 4:05 pm

Post by labeshops » Fri Jul 11, 2014 5:10 pm

Sure.

Edit catalog/controller/product/product.php. Before:

Code: Select all

$this->data['tab_description'] = $this->language->get('tab_description');		
add

Code: Select all

$this->data['home'] = $this->url->link('common/home');
$this->data['name'] = $this->config->get('config_name');
Then edit your template/product/product.tpl. Insert where ever you want it:

Code: Select all

<a href="<?php echo $home; ?>"><?php echo $name; ?></a>

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by Lef » Fri Jul 11, 2014 5:27 pm

Sure.

Edit catalog/controller/product/product.php. Before:


Code: Select all
$this->data['tab_description'] = $this->language->get('tab_description');

add


Code: Select all
$this->data['home'] = $this->url->link('common/home');
$this->data['name'] = $this->config->get('config_name');

Then edit your template/product/product.tpl. Insert where ever you want it:
Code: Select all
<a href="<?php echo $home; ?>"><?php echo $name; ?></a>
First, thank you for your help.

This comes up with the default store. I would like to have the sub store that the item belongs to for a multi store installation. Also be linkable to that store. Something like eBay's "visit store"

thank you again

Lef
Newbie

Posts

Joined
Tue Jun 19, 2012 4:05 pm

Post by Lef » Fri Jul 11, 2014 5:33 pm

ok link is working. I could not see the code before :) but I do not know if it always link to default store

Lef
Newbie

Posts

Joined
Tue Jun 19, 2012 4:05 pm

Post by labeshops » Fri Jul 11, 2014 7:45 pm

No, it will link to which ever store your customer is on.

Not sure what else you are looking for?

If you want it to link to the substore, that is more than what I know how to do off hand.

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by Lef » Sat Jul 12, 2014 4:36 am

After spending the whole day in front of the computer :crazy: finally found the solution :o

well it goes like this :

Bear in mind I ran a multistore based on subdomains.

I used the location field to enter the sub store web address i.e. http://subdomain.domain.com

Then in catalog-->controller-->product-->product.php
find

Code: Select all

$this->data['points'] = $product_info['points'];
and under that put

Code: Select all

/* Lef 11.07.2014 -- load location for store link use */
          $this->data['location'] = $product_info['location'];
          /* end Lef 11.07.2014 */
this is to load the web address from the location field

after go to catalog-->view-->your theme-->template-->product-->product.tpl and find

Code: Select all

<span><?php echo $text_stock; ?></span> <?php echo $stock; ?></div>
and change it to

Code: Select all

<span><?php echo $text_stock; ?></span> <?php echo $stock; ?><br />
 <!-- Lef 11.07.2014 show store link -->
<span id="store_link"><?php echo "<a href=$location>$text_store_link</a>" ?></span></div>
afterwards create a text variable in your language(s) folder
catalog-->language-->your language-->product-->product.php

Code: Select all

// Lef 11.07.2014 text used for store link
$_['text_store_link']   = 'Visit Store';
and load that in catalog-->controller-->product-->product.php
find the line

Code: Select all

$this->data['text_tags'] = $this->language->get('text_tags');
and under it put

Code: Select all

$this->data['text_store_link'] = $this->language->get('text_store_link');
finaly in your theme stylesheet.css
catalog-->view-->your theme-->stylesheet-->stylesheet.css put at the end

Code: Select all

#store_link  a {
	font-size: 14px;
	font-style: bold;
	color: navy;
}
and your done ... ENJOY :P

p.s. now someone make it show only on default store :) I am tired
p.s.2 just checked and because I use a different theme in substores than the default store it does not appear :) If you use the same you have to make it not appear.

Lef
Newbie

Posts

Joined
Tue Jun 19, 2012 4:05 pm
Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 36 guests