check box selection instead increment

  • Posts: 846
  • Thank you received: 92
11 years 4 months ago #111499

Hi

hikashop use increment logic for choose the number of same article
Does hikashop support in the case there is only many unique single article a checkbox ?

Thank's

Last edit: 11 years 4 months ago by lionel75.

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
11 years 4 months ago #111522

Hi,

If you want to be able to add only one product on your add to cart buttons, you can change the option "Display the quantity field on the product page" of the configuration to "no display".

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

  • Posts: 846
  • Thank you received: 92
11 years 4 months ago #111549

No i really need that hikashop handle select item not by define number attach to a product in the client side but by checkbox ....
if end user select an item article ( check) then it mean he could only buy this product once ( after he buy it another the next end user could not buy it )


regard's

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

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

Hi,

Without checkbox it can have the same effect, you jsut have to set a quantity of 1 for the product, and it will be a unique product which can be purchased only once.
In the option you can set too to not display the out of stock products.

To have the checkbox, it will require a button template override, you can find some documentation here:
www.hikashop.com/fr/support/documentatio...r-documentation.html
It require good php knowledges.

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

  • Posts: 846
  • Thank you received: 92
11 years 3 months ago #112178

Hello

Yes i think override is the way to go . You write button override not file template layout override , is it like this ?.In the client side there is no joomla only html css javascript and HTML element and checkbox is html element standart !!! .

i have a look to some code and see a lot of javascript for layout view of article so really not easy to understand. For increment increment "gui" , which implementation choice is use for increment ?
(jquery , ajax , GET /POST , JSON ......... ?
Does cart is the API that manage in the server side the number of product select in the client side ?
www.hikashop.com/fr/support/documentatio...umentation.html#cart


Which files are is use to send "increment gui/widget" and to compute the choice after the user send his choice to the server ?

I think a increment widget is more advance ( javascript is use ) than a default html checkbox !!
so implement checkbox in client side must be more easy when work ( "remove" /simplify code ) for starting coding using a copy of the files that manage increment ( send receive) ?



Could you check if what i write is right or wrong and have more information about button override on the server side ? (some link .... the name of the joomla class to extend )

Thank's

Last edit: 11 years 3 months ago by lionel75.

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
11 years 3 months ago #112189

If you want to add a checkbox for each product on your listings, first you can change the option "Display the quantity field on the product page" of the configuration to "global on listing".
That will display a quantity field for each product with a global add to cart button at the bottom.
Then, you can edit the file add_to_cart_listing via the menu Display->Views and hide the quantity field (with a display:none for example):

<input id="hikashop_listing_quantity_<?php echo $this->row->product_id;?>" type="text" style="width:40px;" name="data[<?php echo $this->row->product_id;?>]" class="hikashop_listing_quantity_field" value="0" />
and add next to it a checkbox with some javascript which will change the value of the input field when the checkbox is ticked or unticked.

I think that it will be the easiest.

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

  • Posts: 846
  • Thank you received: 92
11 years 3 months ago #112528

Do you mean that click on the check box can using javascript
1 change the value stock to 0 ( if enabled) or 1 (if disabled)
2 emulate a click on the hidden button to send information in the server ?
3 update the module cart item with the article ( uncheck/check box article) ?

Thank's

Last edit: 11 years 3 months ago by lionel75.

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
11 years 3 months ago #112537

I mean option 1. You just update the value of the input with javascript. It's basic JS code.
onclick="document.getElementById('hikashop_listing_quantity_<?php echo $this->row->product_id;?>').value=intval(this.checked);"

or something like that.

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

  • Posts: 846
  • Thank you received: 92
11 years 3 months ago #112555

thank's , i hate javascript so i hope it ll work after test some basic code .

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

  • Posts: 846
  • Thank you received: 92
11 years 3 months ago #112737

hi

Last edit: 11 years 3 months ago by lionel75.

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

  • Posts: 846
  • Thank you received: 92
11 years 3 months ago #112739

lionel75 wrote: hi

intval is not define refer to firebug ?

regard's

Last edit: 11 years 3 months ago by lionel75.

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

  • Posts: 82683
  • Thank you received: 13337
  • MODERATOR
11 years 3 months ago #113068

Hi,

it's parseInt, not intval. My mistake. intval is for php:
stackoverflow.com/questions/2322935/trying-to-change-string-int

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

  • Posts: 846
  • Thank you received: 92
11 years 3 months ago #113104

your code was usefull ..
I use your software in a non standart way but it 's really work with little modification !!!

Thank's a lot .

Last edit: 11 years 3 months ago by lionel75.

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

Time to create page: 0.086 seconds
Powered by Kunena Forum