Skip to main content

Price per Unit /Diferent Units

More
12 years 9 months ago #135835 by slipperyman
Hi, I'm starting a project on a pasta shop...
So we have different products sold by different units... How do we show that unit and explain that the price is by that unit... I.E.
Ravioli are sold by Sheet
Caneloni by unit
Spaguetti by weight
Cheese by weight..
Cakes by slice or the whole cake....

So not all of them are a case of "Give me one of that"...
What's the right way to handle this on HikaShop?
Thanks in advance...

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

More
12 years 9 months ago #135862 by Mohamed Thelji
Hi,
Hikashop products are sold by quantity, but note that you'll probably be able to do what you want by using characteristics like weights/Slice.. so that your customers can select what type of product they want and select a quantity.

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

More
12 years 9 months ago #135916 by slipperyman
I guess that with products sold by weight like cheese, where we have packs of 50 /100/150gr can work with variations, but

but How would you handle something like 1,5 kg of noodles?
How would you show to users that the price of caneloni is by unit and Ravioli by sheet insteas of the plain by unit... cause the translation does not handle those variations....

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

More
12 years 9 months ago #135917 by slipperyman
As a quick thought I think that I could handle 1,5 Kg as 1500 grams but it's absolutely not user friendlym besides the problems it would bring with prices, since the value is by Kg... 1kg= $xx,xx

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

More
12 years 9 months ago #135967 by nicolas
Hi,

This is explained in our FAQ:
www.hikashop.com/support/documentation/106-faq.html#tran
under the question: 'I sell packed products, how can I change "each" text in the product page ?'

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

More
10 years 11 months ago #217891 by teamtmedia
Thank you for your concise documentation on the basic process. However when attempting to apply this method to "cheapest price" or "price range" my php is letting me down and I am getting an
Code:
Undefined property: stdClass::$salemethod in .....\html\com_hikashop\product\listing_price.php

for my (rather poorly hacked) code of
Code:
if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){ if($price->price_min_quantity>1){ echo '<span class="hikashop_product_price_per_unit_x">'.JText::_($this->element->salemethod).' '.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>'; }else{ if(isset($this->element->main)) echo JText::_($this->element->main->salemethod); elseif(isset($this->row)) echo JText::_($this->row->salemethod); else echo JText::_($this->element->salemethod); } }

Obviously I do not have the isset statement but this is where I could spend an hour hacking that or just ask nicely. I think the latter is more appealing on a set priced project ;)

Thank you

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

More
10 years 11 months ago #217929 by nicolas
Hi,

If you don't have $this->element->salemethod or $this->element->main->salemethod or $this->row->salemethod
It means that you didn't create a custom field with the column name "salemethod" via the menu Display>Custom fields
Could you check on that ?
Could you do a screenshot of the settings of your custom field ?

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

More
10 years 11 months ago #217953 by teamtmedia
Here's the image as requested. As you can see I have followed your documentation. The thing is that it is working on the price per unit but when I request a range (i.e. the first if statement) it doesn't have the isset. My php is a little behind on the correct creation of this.

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

More
10 years 11 months ago #217967 by nicolas
Hi,

What is the exact error message ?
And what is the full code of the listing_price view file ?
(so that we know the exact line of the error)

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

More
10 years 11 months ago - 10 years 11 months ago #218012 by teamtmedia
OK. Detailed.

I have, as you can see, copied your documentation to the point HOWEVER I would like to use the "per unit" values in the "price range" or "all" options. With the following "listing_price.php"
Code:
<?php /** * @package HikaShop for Joomla! * @version 2.6.0 * @author hikashop.com * @copyright (C) 2010-2015 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?><?php $class =''; if(!empty($this->row->prices) && count($this->row->prices)>1){ $class = ' hikashop_product_several_prices'; } if(isset($this->element->main->product_msrp) && !(@$this->row->product_msrp > 0.0) ) $this->row->product_msrp = $this->element->main->product_msrp; if(isset($this->row->product_msrp) && @$this->row->product_msrp > 0.0 && JRequest::getCmd('layout') == 'show' && $this->params->get('from_module','') == ''){ ?> <span class="hikashop_product_msrp_price hikashop_product_price_full"> <span class="hikashop_product_msrp_price_title"> <?php echo JText::_('PRODUCT_MSRP_BEFORE'); ?> </span> <span class="hikashop_product_price"> <?php $mainCurr = $this->currencyHelper->mainCurrency(); $app = JFactory::getApplication(); $currCurrency = $app->getUserState( HIKASHOP_COMPONENT.'.currency_id', $mainCurr ); $msrpCurrencied = $this->currencyHelper->convertUniquePrice($this->row->product_msrp,$mainCurr,$currCurrency); if($msrpCurrencied == $this->row->product_msrp) echo $this->currencyHelper->format($this->row->product_msrp,$mainCurr); else echo $this->currencyHelper->format($msrpCurrencied,$currCurrency).' ('.$this->currencyHelper->format($this->row->product_msrp,$mainCurr).')'; ?> </span> </span> <?php } ?> <span class="hikashop_product_price_full<?php echo $class; ?>"> <?php if(empty($this->row->prices)){ echo JText::_('FREE_PRICE'); }else{ $first = true; echo JText::_('PRICE_BEGINNING'); $i=0; if(isset($this->row->product_msrp) && @$this->row->product_msrp > 0.0 && JRequest::getCmd('layout') == 'show' && $this->params->get('from_module','') == ''){ echo '<span class="hikashop_product_our_price_title">'.JText::_('PRODUCT_MSRP_AFTER').'</span> '; } $config =& hikashop_config(); if($this->params->get('price_with_tax',3)==3){ $this->params->set('price_with_tax',$config->get('price_with_tax')); } if($this->params->get('show_discount',3)==3){ $this->params->set('show_discount',$config->get('show_discount')); } if($this->params->get('show_original_price','-1')=='-1'){ $this->params->set('show_original_price',$config->get('show_original_price')); } if($this->params->get('show_original_price','-1')=='-1'){ $this->params->set('show_original_price',$config->get('show_original_price')); } foreach($this->row->prices as $k => $price){ if($first)$first=false; else echo JText::_('PRICE_SEPARATOR'); if(!empty($this->unit) && isset($price->unit_price)){ $price =& $price->unit_price; } $start = JText::_('PRICE_BEGINNING_'.$i); if($start!='PRICE_BEGINNING_'.$i){ echo $start; } if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $price->price_min_quantity>1){ echo '<span class="hikashop_product_price_with_min_qty hikashop_product_price_for_at_least_'.$price->price_min_quantity.'">'; } $classes = array('hikashop_product_price hikashop_product_price_'.$i); if(!empty($this->row->discount)){ $classes[]='hikashop_product_price_with_discount'; } if(!empty($this->row->discount)){ if($this->params->get('show_discount')==1){ echo '<span class="hikashop_product_discount">'.JText::_('PRICE_DISCOUNT_START'); if(bccomp($this->row->discount->discount_flat_amount,0,5)!==0){ echo $this->currencyHelper->format(-1*$this->row->discount->discount_flat_amount,$price->price_currency_id); }elseif(bccomp($this->row->discount->discount_percent_amount,0,5)!==0){ echo -1*$this->row->discount->discount_percent_amount.'%'; } echo JText::_('PRICE_DISCOUNT_END').'</span>'; }elseif($this->params->get('show_discount')==2){ echo '<span class="hikashop_product_price_before_discount">'.JText::_('PRICE_DISCOUNT_START'); if($this->params->get('price_with_tax')){ echo $this->currencyHelper->format($price->price_value_without_discount_with_tax,$price->price_currency_id); } if($this->params->get('price_with_tax')==2){ echo JText::_('PRICE_BEFORE_TAX'); } if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax')){ echo $this->currencyHelper->format($price->price_value_without_discount,$price->price_currency_id); } if($this->params->get('price_with_tax')==2){ echo JText::_('PRICE_AFTER_TAX'); } if($this->params->get('show_original_price') && !empty($price->price_orig_value_without_discount_with_tax)){ echo JText::_('PRICE_BEFORE_ORIG'); if($this->params->get('price_with_tax')){ echo $this->currencyHelper->format($price->price_orig_value_without_discount_with_tax,$price->price_orig_currency_id); } if($this->params->get('price_with_tax')==2){ echo JText::_('PRICE_BEFORE_TAX'); } if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax') && !empty($price->price_orig_value_without_discount)){ echo $this->currencyHelper->format($price->price_orig_value_without_discount,$price->price_orig_currency_id); } if($this->params->get('price_with_tax')==2){ echo JText::_('PRICE_AFTER_TAX'); } echo JText::_('PRICE_AFTER_ORIG'); } echo JText::_('PRICE_DISCOUNT_END').'</span>'; }elseif($this->params->get('show_discount')==3){ } } echo '<span class="'.implode(' ',$classes).'">'; if($this->params->get('price_with_tax')){ echo $this->currencyHelper->format(@$price->price_value_with_tax,$price->price_currency_id); } if($this->params->get('price_with_tax')==2){ echo JText::_('PRICE_BEFORE_TAX'); } if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax')){ echo $this->currencyHelper->format(@$price->price_value,$price->price_currency_id); } if($this->params->get('price_with_tax')==2){ echo JText::_('PRICE_AFTER_TAX'); } if($this->params->get('show_original_price') && !empty($price->price_orig_value)){ echo JText::_('PRICE_BEFORE_ORIG'); if($this->params->get('price_with_tax')){ echo $this->currencyHelper->format($price->price_orig_value_with_tax,$price->price_orig_currency_id); } if($this->params->get('price_with_tax')==2){ echo JText::_('PRICE_BEFORE_TAX'); } if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax')){ echo $this->currencyHelper->format($price->price_orig_value,$price->price_orig_currency_id); } if($this->params->get('price_with_tax')==2){ echo JText::_('PRICE_AFTER_TAX'); } echo JText::_('PRICE_AFTER_ORIG'); } echo '</span> '; -----------------THIS SECTION------------------------ if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){ if($price->price_min_quantity>1){ echo '<span class="hikashop_product_price_per_unit_x">'.JText::_($this->element->salemethod).' '.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>'; }else{ if(isset($this->element->main)) echo JText::_($this->element->main->salemethod); elseif(isset($this->row)) echo JText::_($this->row->salemethod); else echo JText::_($this->element->salemethod); } } -----------------END SECTION------------------------ if($this->params->get('show_price_weight')){ if(!empty($this->element->product_id) && isset($this->row->product_weight) && bccomp($this->row->product_weight,0,3)){ echo JText::_('PRICE_SEPARATOR').'<span class="hikashop_product_price_per_weight_unit">'; if($this->params->get('price_with_tax')){ $weight_price = $price->price_value_with_tax / $this->row->product_weight; echo $this->currencyHelper->format($weight_price,$price->price_currency_id).' / '.JText::_($this->row->product_weight_unit); } if($this->params->get('price_with_tax')==2){ echo JText::_('PRICE_BEFORE_TAX'); } if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax')){ $weight_price = $price->price_value / $this->row->product_weight; echo $this->currencyHelper->format($weight_price,$price->price_currency_id).' / '.JText::_($this->row->product_weight_unit); } if($this->params->get('price_with_tax')==2){ echo JText::_('PRICE_AFTER_TAX'); } echo '</span>'; } } if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $price->price_min_quantity>1){ echo '</span>'; } $end = JText::_('PRICE_ENDING_'.$i); if($end!='PRICE_ENDING_'.$i){ echo $end; } $i++; } echo JText::_('PRICE_END'); } ?></span>

I have highlighted the adjusted code. As you can see I have placed
Code:
.JText::_($this->element->salemethod)

into the 1st if statement which generates the "price range" and "all" text. Sadly I haven't been able to define the value in this if statement.

The error I am getting is consistent with this.
Code:
<b>Notice</b> : Undefined property: stdClass::$salemethod in <b>D:\xampp\htdocs\sydney\templates\"sitename removed for client confidentiality on a public forum"\html\com_hikashop\product\listing_price.php</b> on line <b>162</b>
Last edit: 10 years 11 months ago by teamtmedia. Reason: Making section of faulty code clearer

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

More
10 years 11 months ago #218064 by nicolas
Hi,

On the line 162 of your code, I only have that code:
THIS SECTION
So I still don't know what exact line is that error on.
Also, on which page that that error happen ? Could you give a link to it ?
Did you try with $this->row->salemethod instead of $this->element->salemethod ? Do you still get the error if you do ?

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

More
10 years 11 months ago #218419 by teamtmedia
How simple was that?!

So the complete, working code, is
Code:
if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){ if($price->price_min_quantity>1){ echo '<span class="hikashop_product_price_per_unit_x">'.JText::_($this->row->salemethod).' '.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>'; }else{ if(isset($this->element->main)) echo JText::_($this->element->main->salemethod); elseif(isset($this->row)) echo JText::_($this->row->salemethod); else echo JText::_($this->element->salemethod); } }

for future reference

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

Time to create page: 0.252 seconds
Powered by Kunena Forum