Unable to keep track of my registration quatities

newbienewbie Member
Hi guys, I'm a newbie to foxycart & full disclosure, I'm a novice coder trying to see if I can get done the simple things we need on our website.

I'm having trouble keeping track of the quantities of my "registration fees."

For instance, if you go to: https://www.clean-simpletx.com/our-packages-paytrace
and select the payment plan of "monthly" under Standard Package, then "yes" to the delicates option. You're properly charged a registration fee.

If you then, immediately just toggle the delicates option to "no" (leaving payment plan at "monthly") and select add to cart again, the registration fee that should be added gets lost.

I'm missing something, but for the life of me don't know what... Any help would be sincerely appreciated...

Thanks,
Francie

------------------------------------------------------------------------------------------------------------------------------------------
<!-- form -->
<form action="https://clean-simple.foxycart.com/cart" method="post" accept-charset="utf-8">

<input type="hidden" name="name" value="Membership" />
<input type="hidden" name="code" value="Standard" />
<input type="hidden" name="price" value="39" />

<select onchange="yesnoCheck(this);" name="sub_frequency" required>

<option value="" selected>Select Payment Plan</option>
<option value="">One-Time ($39, $25 registration)</option>
<option value="1m{p:139|c+_Monthly}">Monthly ($139/mo, $25 registration)</option>
<option value="6m{p:834|c+_5%Off}">6 Mos ($834/6mo, save 5% + $0 regis!)</option>
<option value="1y{p:1668|c+_10%off}">Yearly ($1,668/yr, save 10% + $0 regis!)</option>

</select>

<input type="hidden" name="2:name" value="Registration Fee" />
<input type="hidden" name="2:code" value="Regis_Fee" />
<input type="hidden" name="2:price" value="25" />
<input type="hidden" name="2:parent_code" value="Standard" />
<input type="hidden" name="2:quantity_min" value="1" />
<input type="hidden" name="2:quantity_max" value="999" />

<br />

<!-- Define the Delicates Bag option -->
<div id="ifYes" style="display: none;">

<select name="Delicates_Bag" required>
<option value="" selected>Add a Delicates bag?</option>
<option value="Yes (+$5){p+5}">Yes (+ $5)</option>
<option value="No">No</option>
</select>

</div>

<script>

function yesnoCheck(that)
{ <!-- Delicates bag option -->
if (that.value !== 0)
{
document.getElementById("ifYes").style.display = "block";
}
else
{
document.getElementById("ifYes").style.display = "none";
}

<!-- Check if 6m or Y plan was selected -->
if (that.value == "6m{p:834|c+_5%Off}" || that.value == "1y{p:1668|c+_10%off}")
{

<!-- If so, set Registration to Free -->
document.getElementsByName("2:name")[0].setAttribute("value","Free Registration ($0)");
document.getElementsByName("2:code")[0].setAttribute("value","Early Plan");
document.getElementsByName("2:price")[0].setAttribute("value","0");
}
else
{
<!-- If not, set Registration to $25 -->
document.getElementsByName("2:price")[0].setAttribute("value",25);
}
}

</script>

<br />

<div>
<button type="submit">Add to Cart</button>
</div>

</form>
Comments
  • fc_adamfc_adam FoxyCart Team
    edited October 13
    @newbie,

    Welcome! Thanks for the detailed post and link to your page, that's super helpful for us - I can see what you're describing there.

    The issue you're seeing relates to the bundled products - and that the registration fee is locked to the parent product. When a child product is locked to the parent, it is unable to be removed individually and it's quantity is also matched to the quantity of the parent it's linked with.

    When the monthly sub with delicates selected is added to the cart, that is adding that bundled product to the cart. The parent product has a code of "Standard_monthly", and that's the code the child product is matching to. When you then deselect the delicates option and add it again - it's again adding a bundle, but the parent product is changed as it is missing the delicates option, so that's added as a separate product to the first one. The child product is still linked to "Standard_monthly" though as it's parent product - and as there are two products with that code, it's linking with the first one (the one that was added previously). As the child product is locked to the parent, it's matching it's quantity and so staying at 1.

    To fix it - you can set the delicates product option to also affect the code. For example, if you update your delicates option like this - that should get it adding the registration fee to both instances of the product:
    <select name="Delicates_Bag" required="" id="yui_3_17_2_1_1507857198588_459">
    <option value="" selected="">Add a Delicates bag?</option>
    <option value="Yes (+$5){p+5|c+_delicates}">Yes (+ $5)</option>
    <option value="No">No</option>
    </select>
  • Thanks so much for the detailed explanation and fix! Works like a charm!!
Sign In or Register to comment.