price by weight

  • Posts: 2
  • Thank you received: 0
13 years 4 months ago #20874

Hi, first off - thank you for Hikashop. I've been using Virtuemart, and Hikashop is a very welcome relief.

My question - how can I set up products to sell by weight?

I'm building an online butchers shop and need to sell, for example, Rump Steak at £15.70 per kilo but have the shopper choose whether they want 250g, 500g, 750g, 1 kilo or 1.5 kilo and be charged the appropriate price. Other products can be sold per unit, say burgers, so that's no problem. I suppose I use the product characteristics but can anyone explain how this could work.

Thanks

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
13 years 4 months ago #20880

You could indeed use characteristics: www.hikashop.com/support/documentation/i...html#characteristics

Create one characteristic weight with the values 250g, 500g, 750g, 1kg and 1.5kg and then add it to your products when editing them. Then, via the manage variants button, you can set a price for each variant.

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

  • Posts: 2
  • Thank you received: 0
13 years 4 months ago #20881

Great, thanks for that, but is there a way those prices can be worked out automatically from the one base price per Kilo?

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
13 years 4 months ago #20882

Well, that's possible to do that as well but that require some custom coding: creating a custom field to select whether or not a product can be both by weight, another one for the weight selection field, the edition of a view to display or not the second custom field based on the first one value, and a plugin to calculate the price based on the weight and the base price.
If you know your way around in PHP, we have a documentation about the creation of product quantity calculation plugins: www.hikashop.com/support/documentation/6...tation.html#override

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

  • Posts: 102
  • Thank you received: 0
13 years 3 months ago #22599

so we used characteristics to this as described above, but then on the product listing page it says under price $2.99 each... ideally we would want it to be the variant label so $2.99 half-pint say...
which file would i edit to change this?

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
13 years 3 months ago #22612

If you want to change the text "each" to "half-pint" you can do that by editing your translation file on the tab Languages of the configuration:
www.hikashop.com/download/languages.html#modify

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

  • Posts: 102
  • Thank you received: 0
13 years 3 months ago #22614

ahhh if it were only that easy i could have done it without help. LOL

i want the variation name to show up. i have for instance variations of half pint, pint and quart... each with a separate price...

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
13 years 3 months ago #22619

Then, you could create a custom field of the type 'product' so that when creating a product you could choose between the different variations.
Then, edit the file listing_price of the view product via the menu Display->Views and change the line:
echo JText::_('PER_UNIT');

to use that custom field value instead:
echo $this->element->CUSTOM_FIELD_COLUMN;

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

  • Posts: 102
  • Thank you received: 0
13 years 3 months ago #22620

will try that tomorrow... when my brain recovers :-)

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

  • Posts: 102
  • Thank you received: 0
13 years 3 months ago #22866

so i added that line: echo $this->element->measurement; to the listing_price template and it works on the main show page but not on the listing_img_desc page. is there a different way to call custom fields on this page...?

sorry, i got it.. actually if you want it to work in both screens you need to call
echo $this->row->measurement;

Last edit: 13 years 3 months ago by MinnieMouse.

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
13 years 3 months ago #22867

Yes. On listings, you have several products. So it's:
$this->row->CUSTOM_FIELD_COLUMN;

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

  • Posts: 102
  • Thank you received: 0
13 years 3 months ago #22868

nicolas, where can i find the content for the links of the ajax popup when you have added something to the cart?
thanks Liz

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
13 years 3 months ago #22869

It's the "notice" file of the "checkout" view that you can edit via Display->Views.

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

  • Posts: 25
  • Thank you received: 1
13 years 1 month ago #26227

how do i remove the custom field i just added to my product page from the default location, and just use it where i decide it should go ?

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
13 years 1 month ago #26250

I'm not following you. Could you explain more what you want to do ?

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

  • Posts: 25
  • Thank you received: 1
13 years 1 month ago #26275

i created a custom field in product, and placed it as you suggested earlier in this topic to replace the 'Each', this is fine.

However it appears that you have also put a piece of code to display custom fields, so my custom field is called in a location where i didn't place any code.

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
13 years 1 month ago #26281

Ah , that's because you set it to be displayed on the front end. You should turn off that option of your custom field and it won't be displayed on your product page.

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

  • Posts: 25
  • Thank you received: 1
13 years 1 month ago #26430

So i have 'echo $this->row->{MYFIELDNAME};' in the listing_price template as described above and the field is disabled in front end. On the category view it reads the custom field as expected (next to the price), however on product page itself the custom field is not shown.

If i enable front end for the field i see it in the right place in category AND product page (next to the price) but also in product page i have it shown under a H4 heading 'Specifications'.

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
13 years 1 month ago #26454

Maybe it's because your product has characteristics ?
In that case, you should try with this for the product page:
echo $this->element->main->CUSTOM_FIELD_COLUMN;

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

  • Posts: 25
  • Thank you received: 1
13 years 3 weeks ago #28497

so i've ended up with the custom field disabled for the front end and this line in product / listing_price.php

echo $this->element->main->CUSTOM_FIELD_COLUMN.$this->row->CUSTOM_FIELD_COLUMN

because ...

$this->element->main->CUSTOM_FIELD_COLUMN // this shows on the main product page but not on the category list page

$this->row->CUSTOM_FIELD_COLUMN // this doesn't show on the main product page but DOES on the category list page

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

Time to create page: 0.131 seconds
Powered by Kunena Forum