Skip to main content

language file change for a specific product

More
11 years 4 months ago #203174 by hsojhsoj
-- url of the page with the problem -- : testpatiodrape.dependentmedia.com/produc...product/127-curtains
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.13
-- Browser(s) name and version -- : all
-- Error-message(debug-mod must be tuned on) -- : no errors

In the language file "English (en-GB)" the line PER_UNIT=" each" is perfect for all my products except one. I sell a product based on price per square foot, so i want it to say "price per square foot." How would you go about this?

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago - 11 years 4 months ago #203186 by Xavier
Hi,

So you will have to edit the view "product / listing_price" and replace:
Code:
echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
By:
Code:
if($this->row->product_id == 'XX'){ // Replace XX by the product id echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_SQUARE_FOOT').'</span>'; }else{ echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>'; }
www.hikashop.com/support/documentation/1...ize-the-display.html

Then add a translation override like:

PER_SQUARE_FOOT="price per square foot"

www.hikashop.com/support/faq.html#tran
Last edit: 11 years 4 months ago by Xavier.

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #203257 by hsojhsoj
Thanks, the text changed for this page:
testpatiodrape.dependentmedia.com/products-listing

but it did not change for this page:
testpatiodrape.dependentmedia.com/produc...product/127-curtains

Is there another view to change?

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #203294 by nicolas
No, it's the same view, but if you want to do it for products with characteristics, then you want to change the line:
if($this->row->product_id == 'XX'){
to:
if($this->row->product_id == 'XX' || $this->element->product_id == 'XX'){
in the code of Xavier

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #203302 by hsojhsoj
I made the change but it did not work.

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #203306 by nicolas
Hi,

Then please try with this line instead:
if($this->row->product_id == 'XX' || $this->element->main->product_id == 'XX'){

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #203327 by hsojhsoj
Thanks so much. It works perfectly. Do you guys have a donate button?

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #203352 by nicolas
Hi,

We don't have a donate button but you can send directly to the email address hikari DOT software AT gmail DOT com via PayPal and we'll receive it.

Thanks !

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago #210544 by hsojhsoj
Something has changed.

this solution:

So you will have to edit the view "product / listing_price" and replace:
echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
By:
if($this->row->product_id == 'XX'){ // Replace XX by the product id
echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_SQUARE_FOOT').'</span>';
}else{
echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
}


works for this page:
testpatiodrape.dependentmedia.com/products-listing

but it did not change text on this page:
testpatiodrape.dependentmedia.com/produc...product/127-curtains

and now these modifications to make the "per square foot" show on both pages do not work:

if($this->row->product_id == 'XX'){
to:
if($this->row->product_id == 'XX' || $this->element->product_id == 'XX'){


and

if($this->row->product_id == 'XX' || $this->element->main->product_id == 'XX'){


all this did work for about a month. Specifically this one

if($this->row->product_id == 'XX' || $this->element->main->product_id == 'XX'){
echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_SQUARE_FOOT').'</span>';
}else{
echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
}


now the text following the product price is this message:

Notice: Undefined property: stdClass::$main in /var/www/vhosts/testpatiodrape.dependentmedia.com/httpdocs/templates/rt_chimera/html/com_hikashop/product/listing_price.php on line 170 Notice: Trying to get property of non-object in /var/www/vhosts/testpatiodrape.dependentmedia.com/httpdocs/templates/rt_chimera/html/com_hikashop/product/listing_price.php on line 170 each

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago #210549 by Jerome
Hi,

Please put "@" before the variables to avoid the warnings.
Like
Code:
if(@$this->row->product_id == 'XX' || @$this->element->main->product_id == 'XX') {

Regards,

PS : Please use the "code" tag instead of the "quote" one ; it made the code easier to read.

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago #210596 by hsojhsoj

Please Log in or Create an account to join the conversation.

Time to create page: 0.220 seconds
Powered by Kunena Forum