increases the quantity of the cart by min.order

  • Posts: 45
  • Thank you received: 3
11 years 4 months ago #109069

Hello,

A customer sells floor coverings. The price he refers is for 1 square meter. (thats very important that this is the price shown!)
But now you can only order 3 square meters at a time. How can I influence the cart so that it always increases the quantity by 3 (minimum order quantity is 3)

I hope the question was expressed understandable?!

Best regards
Maya

Last edit: 11 years 4 months ago by bytekultur.

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

  • Posts: 12953
  • Thank you received: 1778
11 years 4 months ago #109082

Hi Maya,

The best solution will probably be to use a product which will be a 3 square meters product.

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

  • Posts: 45
  • Thank you received: 3
11 years 4 months ago #109117

Hello,

thanks for helping!

the thing is all shops that sell floor coverings show the price by 1 square meter - so if he shows the package price it seems much more expensive...

i already get throuth the diffrent views to find the right place where i could pragramm something like this... i have a checkbox called "square meter product" > so i should be able to make a diffrence between normal products and square meter products...

now i should be able to make a query that increase in square meter products the cart quantity only by minimum order quantity... but i can't find the right view where i have to write such a query... (programin should not be a problem)

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

  • Posts: 12953
  • Thank you received: 1778
11 years 4 months ago #109274

So the solution will probably be to do it through the "administrator/components/com_hikashop/helper/cart.php" file, by overriding the hikashop_quantity_render function.

The following user(s) said Thank You: bytekultur

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

  • Posts: 45
  • Thank you received: 3
11 years 4 months ago #110099

Hello :-)
thanks a lot for helping!!!

Now i had the time to test this...

So far I found the solution ... but now i have an other little questions...

how am i able to get the value of a custom field in the file "administrator/components/com_hikashop/helper/cart.php" file
i have some custom fields where i need to get the value from for my variable $quantitysteps =5;



and here are my changes if anyone has the same ideas

change:

<a id="hikashop_product_quantity_field_change_plus_'.$i.'" class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange(\'hikashop_product_quantity_field_'.$i.'\',1,'.$max_quantity.','.$min_quantity.');">+</a>

<a id="hikashop_product_quantity_field_change_minus_'.$i.'" class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange(\'hikashop_product_quantity_field_'.$i.'\',0,'.$max_quantity.','.$min_quantity.');">&ndash;</a>
to (i added a variable in the on click (hikashopQuantityChange))
$quantitysteps =$min_quantity; 

<a id="hikashop_product_quantity_field_change_plus_'.$i.'" class="hikashop_product_quantity_field_change_plus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange(\'hikashop_product_quantity_field_'.$i.'\','.$quantitysteps.','.$max_quantity.','.$min_quantity.','.$quantitysteps.');">+</a>

<a id="hikashop_product_quantity_field_change_minus_'.$i.'" class="hikashop_product_quantity_field_change_minus hikashop_product_quantity_field_change" href="#" onclick="return hikashopQuantityChange(\'hikashop_product_quantity_field_'.$i.'\',0,'.$max_quantity.','.$min_quantity.','.$quantitysteps.');">&ndash;</a>

also change the following lines in the function "function hikashopQuantityChange(field,plus,max,min){" from:
function hikashopQuantityChange(field,plus,max,min){

fieldEl.value=parseInt(fieldEl.value)+1;

fieldEl.value=current-1;
to
function hikashopQuantityChange(field,plus,max,min,steps){

fieldEl.value=parseInt(fieldEl.value)+steps;

fieldEl.value=current-steps;

Last edit: 11 years 4 months ago by bytekultur.

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

  • Posts: 12953
  • Thank you received: 1778
11 years 4 months ago #110107

All your customfield are saved through your Hikashop database tables, so I think that you'll just have to do with an SQL request.

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

  • Posts: 45
  • Thank you received: 3
11 years 4 months ago #110112

ok i thought about that - but is there no way to get it over the hika shop functions
> in the view im able to aks a field by this->row->meter

would be a bit nicer than a sql query...

and how do i find out the id of the product when i'm in this view (i would need it for the query)

Last edit: 11 years 4 months ago by bytekultur.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 4 months ago #110177

Hi,

There is an easiest solution, in the product configuration page, you can edit the value of the field "Minimum quantity per order" and set it to 3.
By this way the customer must take minimum 3 products, so 3 squares meter and the price displayed is for 1 square meter.

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

Time to create page: 0.085 seconds
Powered by Kunena Forum