language file change for a specific product

  • Posts: 61
  • Thank you received: 0
10 years 3 months ago #203174

-- 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.

  • Posts: 13201
  • Thank you received: 2322
10 years 3 months ago #203186

Hi,

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>';
}
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: 10 years 3 months ago by Xavier.

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

  • Posts: 61
  • Thank you received: 0
10 years 3 months ago #203257

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.

  • Posts: 84305
  • Thank you received: 13700
  • MODERATOR
10 years 3 months ago #203294

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.

  • Posts: 61
  • Thank you received: 0
10 years 3 months ago #203302

I made the change but it did not work.

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

  • Posts: 84305
  • Thank you received: 13700
  • MODERATOR
10 years 3 months ago #203306

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.

  • Posts: 61
  • Thank you received: 0
10 years 3 months ago #203327

Thanks so much. It works perfectly. Do you guys have a donate button?

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

  • Posts: 84305
  • Thank you received: 13700
  • MODERATOR
10 years 3 months ago #203352

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.

  • Posts: 61
  • Thank you received: 0
10 years 1 month ago #210544

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.

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 1 month ago #210549

Hi,

Please put "@" before the variables to avoid the warnings.
Like

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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 61
  • Thank you received: 0
10 years 1 month ago #210596

cool

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

Time to create page: 0.077 seconds
Powered by Kunena Forum