Skip to main content

show only selected value in checkout

12 years 7 months ago - 12 years 7 months ago #152331 by kaya
Hi dear
I have a problem in checkout part. when select count product after refresh page only show value 1 but i want show my selected value
this is my code:
Code:
<select id="hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>" type="text" name="item[<?php echo $row->cart_product_id;?>]" class="hikashop_product_quantity_field" value="<?php echo $row->cart_product_quantity; ?>" onchange="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>').value=qty_field.value;"> <option value="1" onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field && qty_field.value != '<?php echo $row->cart_product_quantity; ?>'){<?php echo $input; ?> qty_field.form.submit(); } return false;" title="<?php echo JText::_('HIKA_REFRESH'); ?>">1</option> <option value="2" onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field && qty_field.value != '<?php echo $row->cart_product_quantity; ?>'){<?php echo $input; ?> qty_field.form.submit(); } return false;" title="<?php echo JText::_('HIKA_REFRESH'); ?>">2</option> <option value="3" onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field && qty_field.value != '<?php echo $row->cart_product_quantity; ?>'){<?php echo $input; ?> qty_field.form.submit(); } return false;" title="<?php echo JText::_('HIKA_REFRESH'); ?>">3</option> </select>
thank you
Last edit: 12 years 7 months ago by kaya.

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

12 years 7 months ago #152389 by Xavier
Hi,

Thanks to try that code:
Code:
<select id="hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>" type="text" name="item[<?php echo $row->cart_product_id;?>]" class="hikashop_product_quantity_field" value="<?php echo $row->cart_product_quantity; ?>" onchange="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>').value=qty_field.value;"> <option value="1" <?php if($row->cart_product_quantity == '1') echo 'selected="selected"'; ?> onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field && qty_field.value != '<?php echo $row->cart_product_quantity; ?>'){<?php echo $input; ?> qty_field.form.submit(); } return false;" title="<?php echo JText::_('HIKA_REFRESH'); ?>">1</option> <option value="2" <?php if($row->cart_product_quantity == '2') echo 'selected="selected"'; ?> onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field && qty_field.value != '<?php echo $row->cart_product_quantity; ?>'){<?php echo $input; ?> qty_field.form.submit(); } return false;" title="<?php echo JText::_('HIKA_REFRESH'); ?>">2</option> <option value="3" <?php if($row->cart_product_quantity == '3') echo 'selected="selected"'; ?> onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field && qty_field.value != '<?php echo $row->cart_product_quantity; ?>'){<?php echo $input; ?> qty_field.form.submit(); } return false;" title="<?php echo JText::_('HIKA_REFRESH'); ?>">3</option> </select>

You forgot to add the "selected" attribute if the value is equal to the product quantity in the cart.
The following user(s) said Thank You: kaya

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

12 years 7 months ago #152470 by kaya
thank you it's work now.
I have a new problem in another file. i want to change my input tag to select tag but when change it my delete not work.
my input it's:
Code:
<input id="hikashop_cart_quantity_<?php echo $row->cart_product_id;?>" type="text" name="item[<?php echo $row->cart_product_id;?>][cart_product_quantity]" class="hikashop_product_quantity_field" value="<?php echo $row->cart_product_quantity; ?>" onchange="var qty_field = document.getElementById('hikashop_cart_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field){<?php echo $input; ?> } document.<?php echo $form; ?>.submit(); return false;" />

and i want change to this select list:
Code:
<select id="hikashop_cart_quantity_<?php echo $row->cart_product_id;?>" type="list" name="item[<?php echo $row->cart_product_id;?>][cart_product_quantity]" class="hikashop_product_quantity_field" value="<?php echo $row->cart_product_quantity; ?>" onchange="var qty_field = document.getElementById('hikashop_wishlist_quantity_<?php echo $row->cart_product_id;?>');" > <option value="1" <?php if($row->cart_product_quantity == '1') echo 'selected="selected"'; ?> onclick="var qty_field = document.getElementById('hikashop_wishlist_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field){<?php echo $input; ?> } document.<?php echo $form; ?>.submit(); return false;" >1</option> <option value="2" <?php if($row->cart_product_quantity == '2') echo 'selected="selected"'; ?> onclick="var qty_field = document.getElementById('hikashop_wishlist_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field){<?php echo $input; ?> } document.<?php echo $form; ?>.submit(); return false;" >2</option> <option value="3" <?php if($row->cart_product_quantity == '3') echo 'selected="selected"'; ?> onclick="var qty_field = document.getElementById('hikashop_wishlist_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field){<?php echo $input; ?> } document.<?php echo $form; ?>.submit(); return false;" >3</option> </select>

how can change it my delete work?

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

12 years 7 months ago - 12 years 7 months ago #152476 by kaya
I found how can do it...
with add this options its work
Code:
<option value="0" style="display: none" <?php if($row->cart_product_quantity == '0') echo 'selected="selected"'; ?> onclick="var qty_field = document.getElementById('hikashop_wishlist_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field){<?php echo $input; ?> } document.<?php echo $form; ?>.submit(); return false;" >0</option>
Last edit: 12 years 7 months ago by kaya.
The following user(s) said Thank You: Mohamed Thelji

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

Time to create page: 0.060 seconds
Powered by Kunena Forum