Franz Holzinger

Verse of the day

Denn es ist ein Gott und ein Mittler zwischen Gott und den Menschen, nämlich der Mensch Christus Jesus, der sich selbst gegeben hat für alle zur Erlösung, daß solches zu seiner Zeit gepredigt würde;
1 Timotheus 2:5-6

© Bible Gateway's Verse of the Day


autor  
8-03-11 12:31:29 Delete item from basket in one click
Julia Pekkonen
Hello all (and Franz - personally)
Please help me with deleting item from basket.
I have in basket only 1pcs. of each products (no more) and I need delete item "in one click" - pressed "delete icon" near each item and it all. No necessary clicking on someone other button. It's possible?
8-03-11 12:51:32 Delete item in basket
Franz Holzinger
You can use:
<input type="submit" class="button3" name="products_clear_basket" value="Warenkorb l&ouml;schen">
to delete all items from the basket.

If you want to have a delete icon on the right side of each item, then you can make it using JavaScript. The JavaScript must take care, that the amount of the item is set to zero and that the form is submitted.
See the image RemoveItem.gif of the extension addons_tt_products.
10-03-11 21:30:51 Working variant
Julia Pekkonen
Hi everyone (and Franz)
This is working code (for my purposes).
Many thanks for support!

<form method="post" action="###FORM_URL###" name="basket" class="basketForm">
<div class="FIELD_QTY_BASKET2">
<INPUT type="hidden" id="###FIELD_NAME_BASKET###" name="###FIELD_NAME_BASKET###" value="###FIELD_QTY###"/>
<a class="minus" onClick="document.getElementById('###FIELD_NAME_BASKET###').value = '0'; document.forms[0].submit();"><img src="fileadmin/templates/i/minus-grey.gif" width="11" height="11" border="0" /></a> </div>
</div>

</form>
18-07-11 10:02:00 Other solution
Vincent Mans
Because there is a submit, this could lead to problems if the visitor uses the enter button on his keyboard.

And by the way, the solution in the manual does not work at all (for me).

Other solution: Jquery. This line, by the way, adds one or substracts one. In this case, if someone enters on the keyboard, the value is increased by one. Which is less harmful. You can also use type="button" but then the amount is not recalculated unless one presses "actualize cart".

In the template:

<div id="FIELD_QTY_BASKET2">
<input class="quantity2" type="text" name="###FIELD_NAME_BASKET###" value="###FIELD_QTY###"/>
<input type="submit" value="+" id="add1" class="add" />
<input type="submit" value="-" id="minus1" class="minus" />
</div>

In the js file or header or footer:

$(function()
{
$(".add").click(function()
{
var currentVal = parseInt($(this).next(".quantity2").val());
if (currentVal != NaN)
{
$(this).next(".quantity2").val(currentVal + 1);
}
});

$(".minus").click(function()
{
var currentVal = parseInt($(this).prev(".quantity2").val());
if (currentVal != NaN)
{
$(this).prev(".quantity2").val(currentVal - 1);
}
});
});
18-07-11 10:15:55 little error, this works:
Vincent Mans
template code should be:

<input type="submit" value="+" id="add1" class="add" />
<input class="quantity2" type="text" name="###FIELD_NAME_BASKET###" value="###FIELD_QTY###"/>
<input type="submit" value="-" id="minus1" class="minus" />
7-10-11 13:10:13 Problems after update to 2.7.2
Julia Pekkonen
Hello Franz and everyone.
I decide ask about problem after updated from 2.7.0 to 2.7.2.
Feature delete item doesn't work in new version (I guess Franz changed something in this part)
I have in basket template:
<form method="post" action="###FORM_URL###" name="basket" class="basketForm">
<INPUT type="hidden" id="###FIELD_NAME_BASKET###" name="###FIELD_NAME_BASKET###" value="###FIELD_QTY###"/>
<a class="minus" onClick="document.getElementById('###FIELD_NAME_BASKET###').value = '0'; document.forms[0].submit();">[-] von Merkliste entfernen</a>
<input type="hidden" name="mode_update" value="1"/>
</form>
In 2.7.0. this work properly, but in 2.7.2 not :( When I click to icon [-] I goes to search page (?) with text "Es wurden keine Artikel gefunden." instead delete item from basket. I'm not changed TS constants for tt_products and all must working correct.
7-10-11 23:45:28 document.forms[0].submit();
Franz Holzinger
It seems that you have more than one form on the basket page. And one of them is the search plugin.

Do not use 'document.forms[0].submit();'. Instead use here 'document.getElementById(...)'.
Your basket form should have a tag id.
8-10-11 22:46:05 Franz you are my Nr. 1! ;)
Julia Pekkonen
This is correct code:
<INPUT type="hidden" id="###FIELD_NAME_BASKET###" name="###FIELD_NAME_BASKET###" value="###FIELD_QTY###"/>
<a class="minus" onClick="document.getElementById('###FIELD_NAME_BASKET###').value = '0'; document.getElementById('basketForm').submit();">[-] von Merkliste entfernen</a>
< Zurück zum Forum