Post by josee225 » Mon Feb 27, 2012 1:21 am

Hi,

I have a bilingual store (English/French) I am working on, bought a template on Theme Forest, and now I would like to change the "sale" image in french:
http://cartamagicastore.com/OpenC/product/special
So I went ahead and created a .product-sale-fr class, a french image, tested it and it looks fine.

Now I just don't now how to implement it in my templates. I know I need to do something like: if English, display this, if not, display that. I just don't know how to achieve this. The exact code in the template file is this:

Code: Select all

 <?php if ($product['thumb']) { ?>
		<div class="image"><?php if ($product['special']) { ?><div class="product-sale"></div><?php } ?><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
      <?php } ?>
Could anyone help me out with this ? Thank you!!
Last edited by josee225 on Tue Feb 28, 2012 6:19 am, edited 1 time in total.

New member

Posts

Joined
Tue Dec 27, 2011 10:42 pm

Post by josee225 » Mon Feb 27, 2012 11:53 pm

Just to be more precise, I am talking of product labels here. Thanks!

New member

Posts

Joined
Tue Dec 27, 2011 10:42 pm

Post by josee225 » Tue Feb 28, 2012 2:39 am

I just tried something, but it failed. I am sure it is due to syntax error. Could someone check it out please ?

Here is what I did:

Code: Select all

    <?php if ($product['thumb']) { ?>
          <div class="image"><?php if ($product['special']) { ?><div class="product-sale-'<? $language['code']; ?>'"></div><?php } ?><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
          <?php } ?>
and

Code: Select all

<div class="image"><?php if ($product['special']) { ?><div class="product-sale-'<?php echo $language['code']; ?>'"></div><?php } ?><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
Of course, my style sheet includes the proper class: product-sale-french and product-sale-english.

New member

Posts

Joined
Tue Dec 27, 2011 10:42 pm

Post by josee225 » Tue Feb 28, 2012 6:18 am

Ok so I solved this:

In the controller (in this case catalog/controller/product/category.php), I looked for:

Code: Select all

<?php 
class ControllerProductCategory extends Controller {  
	public function index() { 
and added at the next line:

Code: Select all

$this->data['language_code'] = $this->session->data['language'];
I then went to my template file (catalog/view/theme/yourtheme/template/product/category.tpl) and changed my info from:
<div class="product-sale-<?php echo $language_code; ?>"></div>
And then proceeded to modify my css as follow:
duplicate all instances of product-sale classes and added to each -fr and -en

And that did the trick! Now all that is left is to do the same to all needed templates and controllers!

New member

Posts

Joined
Tue Dec 27, 2011 10:42 pm

Post by jenniferrus2 » Thu Oct 12, 2017 1:50 pm

Offering discounts for your online store can be a powerful weapon in your conversion arsenal, however, used haphazardly, and you can do significant damage to your brand or worse, become unprofitable.

New Year Sale


Newbie

Posts

Joined
Thu Oct 12, 2017 1:49 pm
Who is online

Users browsing this forum: No registered users and 61 guests