Product and Category Discount problems

stkstk Member
in General edited February 2016
Hello,

Recently, we have decided to reorg some categories and in doing so, we are wanting to change from a category discount to a product discount, but are running into a couple of problems.

1) Based on the WIKI, a product discount can be entered as part of a form where "no category discounts" is chosen in the category admin page. Unfortunately, this does not yield the expected result as shown by the graphic in the WIKI (i.e., No "Product Discount: -$X.XX" amount in the cart).

Below is the test code & image of the result:

<span class="wolf">
<input type="hidden" name="1:name" value="Spirit-bead (Wolf)"></input>
<input type="hidden" name="1:category" value="Spirit Beads"></input>
<input type="hidden" name="1:price" value="34.99"></input>
<input type="hidden" name="discount_quantity_percentage" value="Quantity Discount(allunits|5-10|10-15)"></input>
<input type="hidden" name="coupon" value="Spirit-Beads"></input>
<label>Wolf QTY</label>
<select name="1:quantity">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select>
</span>


image

The WIKI would suggest this is the proper way to go about setting a product discount, so I am wondering what I might be doing wrong here?

2) In testing the product discount, I also tested a category discount (i.e., deleted the hidden form tag for "Quantity Discount" and setting up a similar category discount on the category admin page. Yay! it works, but results in an unanticipated result: it includes some strange characters after the $-amount of the discount (as shown by the red arrow in the image below).

image

So, in summary, I'm looking for some assistance in two things:

1) Getting the "product discount" to function properly
2) Eliminating the unusual characters that show up after the dollar amounts in the cart display.

Thanks in advance for your help.

EDIT - If it helps, here is the live page which I was editing to test - https://nicolpawn.ca/pawn.php/spirit-beads (currently set for category discounts).
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    @stk,
    1) Getting the "product discount" to function properly
    Just a small error with the discount syntax - you want curly brackets around the tiers like Quantity Discount{allunits|5-10|10-15}
    2) Eliminating the unusual characters that show up after the dollar amounts in the cart display.
    I believe what you're seeing there should be "..." to denote that the price is a fractional amount, more than 2 decimals. If you add a UTF-8 encoding meta tag to your page, I believe that should then display correctly - a tag like this:

    <meta charset="UTF-8">
  • @fc_adam

    Thanks. I can't believe I missed curly brackets ... and thanks!

    I will check the charset for the page ( "charset=iso-8859-1"), while the form includes "accept-charset="utf-8"

    What are the ramifications of changing the page charset?

    Thanks.

    Cheers,
    stk
  • fc_adamfc_adam FoxyCart Team
    @stk,

    The charset dictates what characters can display on the page. According to this page, switching to UTF-8 should just expand the supported characters as ISO-8859-1 only supports a limited subset.
  • We'll give it a whirl. Just concerned about catering to a single page, when we literally have thousands of others served up with a different charset. Thanks!
  • @fc_adam - Thanks for the link re: UTF-8 vs. ISO-8859-1. It is an easy-to-understand comparison and provided me with new information (which is always good).

    Finding WHERE to make that change was the difficult part, as it was buried in a config file (/conf/locales.php) utilized by the site CMS (I had to force the UTF-8 charset. Apparently, the charset is auto-"magically" set when the user picks their "locale". For me what's EN-CA (English-Canadian). It is a tad unclear whether this changes the I/O to the MySQL database or just the delivery of the rendered content).

    The good news: When the offending page charset was changed to UTF-8, it did remove the odd characters, but it looks like they are replaced by ellipsis (i.e., "...")

    The question: why would the $ amount in the cart have trailing ellipsis? Wouldn't it make more sense not to have any characters after the $ amount?
  • stkstk Member
    edited February 2016
    Sorry @fc_adam, I didn't fully read your reply and I now understand why the ellipses. Thank you.

    LOL (wish I could delete my dumb post above) ... :-p

    NEW PROBLEM - Which is actually an old problem. I corrected the syntax to use curly braces, but the product discount is still not being applied. Here is the page: https://nicolpawn.ca/pawn.php/spirit-beads

    (The category quantity discounts are OFF and a product quantity discount - curly braces fix - is now applied for the WOLF spirit bead - the first in the list, but no discount is registered at either levels 10% off for 5+ ... 15% off for 10+)

    Please advise and TIA.

    code:
    <span class="wolf">
    <input type="hidden" name="1:name" value="Spirit-bead (Wolf)"></input>
    <input type="hidden" name="1:category" value="Spirit Beads"></input>
    <input type="hidden" name="1:price" value="34.99"></input>
    <input type="hidden" name="discount_quantity_percentage" value="Quantity Discount{allunits|5-10|10-15}"></input>
    <input type="hidden" name="coupon" value="Spirit-Beads"></input>
    <label>Wolf QTY</label>
    <select name="1:quantity">
    <option>0</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    <option>6</option>
    <option>7</option>
    <option>8</option>
    <option>9</option>
    <option>10</option>
    </select>
    </span>

  • fc_adamfc_adam FoxyCart Team
    @stk,

    Try prefixing the input name with 1:. While that should be assumed by the system - it looks like it isn't there when it's mixed in with some that are and some that aren't.
  • @fc_adam -

    Thank you. That solves the immediate problem. And you were correct, each product needed the prefix number.

    But this creates another dilemma. The goal will be to have each of the "spirit bead" products be included in the "buy 5 or more and get 10% off" and "buy 10 or more and get 15% off" discount. The only way I know how to do that is to have each "spirit bead" product in a "spirit bead" category.

    However, we want to have all jewellery in its own category because all jewellery has a category discount of "buy $100 or more and get free shipping" (because all jewellery is relatively light in weight and small in size, so it make sense to have this as its own category).

    What's the best way to handle this? (Though there are 7 distinct "spirit bead" products in the (as-yet-to-be-defined) "Jewellery" category, is there a way to allow a product discount that allows customers to pick multiple "spirit bead" products and have it apply to the "quantity percentage off" discount? (As it stands as currently coded, choosing six different spirit bead products results in zero discount ... not what we advertised, or entended).

    Makes me kind of wish FC had "sub-categories". Any discussion about this enhancement or feature? And what do we do in the meantime?
  • fc_adamfc_adam FoxyCart Team
    @stk,

    Yeah, product discounts as defined will only apply to a single product. Category discounts and coupons can apply to multiple products.

    As you're already using a category discount that covers these items, your next best bet would be to use a coupon. In 2.0 you can specify coupons to only apply to products that match a certain product code value. So if all the spirit bead products shared a commonality to their code, you could use that to make the coupon only apply to those products. You could then automatically add the coupon to the cart, either along with the add to cart or using javascript so that it will be there without the customer needing to add it.
  • stkstk Member
    edited February 2016
    Thanks for the near-realtime response @fc_adam.

    Can you expand on "certain product code value" and "shared a commonality to their code" bits? Not sure to which you are specifically referring. (i.e., "name" values for products? or something else?)

    FWIW each spirt bead now has a different "name" value:

    <input type="hidden" name="1:name" value="Spirit-bead (Wolf)"></input>
    <input type="hidden" name="2:name" value="Spirit-bead (Whale)"></input>
    <input type="hidden" name="3:name" value="Spirit-bead (Eagle)"></input>


    ... etc.

    The current plan would be to use a coupon for "$8 off with a purchase of $100 or more" (which equates to "free shipping" for anything in the jewellery category). No category discounts and a product discount (somehow including all spirit beads products)

    Again this seems to speak to the idea of additional functionality of "sub-categories".

  • fc_adamfc_adam FoxyCart Team
    @stk,

    Sure thing. If you take a look at the coupon creation form in the admin, you'll see an option there for "restrict usage by product code". That's the setting I'm referring to.

    Within your products you can specify a code attribute - like <input type="hidden" name="1:code" value="spiritbead-wolf" />. If all of the spirit beads had a similar code - just with the different name after the dash, then you could limit the coupon code to product codes like spiritbead-*. That would match as a wild card anything that had a code that started with "spiritbead-".

    That way - the coupon will only apply to the spirit bead products, even though they don't have a category that only they belong to.
  • @fc_adam - OKAY. Great!

    I'll have a play, as it adds another dimension to the discounting options.

    Thank you very much for your help and quick response!

    Have a great weekend!
  • stkstk Member
    @fc_adam

    I wanted to circle back on this topic, both in an effort to provide FC w/some (what I hope is valuable) information, to make certain I have an understanding of the systems benefits and limitations and in an effort to effectively develop a good product / category / shipping / coupon plan.

    When we started with FC, we put our products into categories, which made organisational sense to us. However, one of the limitations we seemingly bumped into involved shipping charges. Because shipping charges are category-based, there didn't seem to be a way to intelligently combine products into a single shipping container and modify the shipping charges accordingly (shipping charges across categories appears to be the summation of each category flat-rate shipping fee).

    EXAMPLE: We initially created a category for "Spirit Beads" and "Native Pendants". Because each item was small, we charged $8 for shipping any number of units. We also created a coupon that removed the $8 fee, if three or more were purchased, effectively creating a promotion for "Buy 3, get Free Shipping". However, if a customer bought 1 spirit bead and 1 pendant, the shipping total was $8+$8=$16, which didn't make sense.

    QUESTION: Are there any tools currently for doing anything other than summing category-based shipping fees?

    FEATURE REQUEST: It would be really great (especially because our shop is "The Mattress Store" analogy used in the shipping fees discussion we read on FC somewhere) to have a more intelligent way of calculating a total shipping charge that made more real-world sense. Of course, that is undoubtedly a huge development investment on the coding end & I have no idea how to suggest it, but it seems like a user-created 3-dimentional look-up table (category combinations + quantities in each category + pre-determined shipping fee) might be the best way forward. I remember reading that a revamp of "shipping" module was on the to-do list.

    (Note: We're in Canada & last we looked, Live Shipping Rates wasn't an option for us, so we're using flat rate fees)

    Our second (and most current) strategy is to create categories based along shipping fees. So, in the case of the products we're rolling out first - Spirit Beads, Native Pendants & Sterling Silver Chains (all have relatively low-prices & are small in size) we're putting them all into one category (low-cost jewellery) which allows us a workaround for what seems to be a limitation in how shipping fees are handled.

    -----------------------------

    COUPONS: The ability to apply coupons to categories is nice, however, as we played with that option, we quickly realized that the coupon (discount) are only applied WITHIN selected categories, which was not how we wished to use them. (e.g., Buy 3 get $ off only applies withing Category A and within Category B) ... whereas, we wanted to apply the coupon ACROSS categories selected. In other words, buy 2 products in Category A and 1 in Category B kicks in the "Buy 3 get $ off".

    QUESTION: Is there an easy way to have coupon discounts apply across categories? ... If not ...

    FEATURE REQUEST - Expand coupon functionality with radio buttons: "Apply [ ] WITHIN or [ ] ACROSS selected categories"

    ----------------------------

    CODES: I haven't yet had a play with product codes, but I can tell that this will add functionality, so I appreciate you turning me on it. I note that coupons can be applied to several (comma delimited) codes and that the syntax allows a "*" wildcard.

    QUESTIONS: Is it possible for a product to have multiple codes? (which would further allow more grouping combinations) And if so, what would that syntax look like?

    ----------------------------

    PRODUCTS: In my attempt to create my first product-level discount, I ran into the same problem we ran into with the coupon categories (only applied within that one product and not across products).

    While this makes sense (not sure why I expected something different), but it raised another question for me.

    QUESTION: What actually defines "a product"? Is it the "name" of the product? Is it a single product entry in a tag. Is it possible to apply a product level discount that applies to the same product that has different SKU values?

    -----------------------------

    I appreciate your input to these questions and I am hoping they make sense. I am still trying to GROK the FC system and move forward in a way that makes organisational sense (and keeps us from having to back-track and rebuild FC shopping code).

    QUESTION: I am a tad surprised that there isn't a Category & Sub-category construct within FC. Is that something that has been considered, as I struggle with the best way to organise our mattress store!

    Thanks again (in advance) for your help.

    Cheers,
    -stk
  • fc_adamfc_adam FoxyCart Team
    @stk,
    QUESTION: Are there any tools currently for doing anything other than summing category-based shipping fees?
    Our current default shipping is quite limiting. We have javascript snippets on our wiki for expanding on the flexibility for that: wiki.foxycart.com/v/2.0/snippets, including creating custom flat rate tiers.

    But...
    FEATURE REQUEST: It would be really great (especially because our shop is "The Mattress Store" analogy used in the shipping fees discussion we read on FC somewhere) to have a more intelligent way of calculating a total shipping charge that made more real-world sense.
    As you noted, our shipping rebuild has been a long time coming. We've got a portion of that coming online very soon which will allow for a custom shipping endpoint. What that will entail is essentially a endpoint script you can host on your server that defines what the shipping charges will be. Instead of sending a request to our live rate calculations, we send a request to your endpoint with the current cart information - and you can reply with any rates you want, giving you the greatest flexibility but with a native feature set. When this launches in the near future, this would probably be a great solution for your needs.
    QUESTION: Is there an easy way to have coupon discounts apply across categories?
    By default a coupon will apply to all categories - but you can deselect the all categories option and select individual categories that it should apply to. You'll find that option on the coupon edit screen.
    QUESTIONS: Is it possible for a product to have multiple codes? (which would further allow more grouping combinations) And if so, what would that syntax look like?
    Not at this time - just a single code value.
    QUESTION: What actually defines "a product"? Is it the "name" of the product? Is it a single product entry in a tag. Is it possible to apply a product level discount that applies to the same product that has different SKU values?
    A product is a unique set of attributes. So for example, if you had a product form on your site for a tshirt, and it had a dropdown for the colour. If someone added a red tshirt and a yellow tshirt, this would be considered as two products. Even though the rest of their attributes match, the different colour value makes them distinct products.
    QUESTION: I am a tad surprised that there isn't a Category & Sub-category construct within FC. Is that something that has been considered, as I struggle with the best way to organise our mattress store!
    It's something that has been discussed, but we don't have any current plans for supporting nested categories at this stage.
  • stkstk Member
    @fc_adam,

    As usual, thanks for the promptness of your reply. It is sincerely appreciated.

    I think I need to further clarify the question about coupons "across" categories. I understand the default being "all categories" and the selection of categories. However, our experience has shown that the coupon discount applies only WITHIN the selected category (as opposed to ACROSS the selected categories).

    The following example illustrates the distinction:

    Coupon Discount = "$1 off purchase of 3 or more" applied to 2 categories:
    1. category A products (all $X each)
    2. category B products (all $Y each).
    Customer #1 buys 3 category A products and 1 category B product, Price = (3X - $1) + 1Y
    (i.e., customer must buy 3 or more of either A products OR B products in order to get the discount ... as they are calculated separately WITHIN each category).

    Customer #2 buys 2 category A products and 2 category B products. Price = 2X +2Y (no discount, even though they've purchased 4 products). We're looking to see the best way to apply the coupon ACROSS the categories selected, rather than WITHIN the categories selected.

    (i.e., We have two separate categories that BOTH offered "Buy 3 get $8 off" and we were looking for a way to honour that 'ACROSS' both categories, as opposed to 'within' each category).

    Product level discounts won't do it.
    Category level discounts won't do it.
    Coupon discount don't do it (natively), but could, if we "burn" our 1 code option to do it.

    (Just trying to get a handle on the capacity of the system to mix/match products for special targeting for various options).

    Like - It would be nice to have the ability to modify shipping based on cart value (i.e., Zero all shipping costs for orders of $100 or more). Or ... honour a Buy 3 in any of these categories and get $X off ... stuff like that.

    Hope this makes sense.

    Cheers,
    -stk

  • fc_adamfc_adam FoxyCart Team
    @stk,

    A coupon will apply to all products from all categories that it can apply to.

    So from your example - if I purchase 2 from category A and 2 from category B - that will activate a coupon that needs three or more products and is applied to both Category A and B.

    If you're seeing it behave otherwise, if you could let us know the store and some product links we can use to replicate, we'd be happy to take a look.
  • stkstk Member
    @fc_adam,
    So from your example - if I purchase 2 from category A and 2 from category B - that will activate a coupon that needs three or more products and is applied to both Category A and B.
    OKAY ... thanks. This description appears to be different from what we are both experiencing & reporting in our test deployments. I will return to test again and report back with live links to our store pages, if I can confirm different behavior.

    Cheers for now.
    -stk
  • stkstk Member
    @fc_adam

    So, after a bit of a play, there appears to be both good news and bad news.

    The good news is that the system appears to behaving as you said. (i.e., buying 2 spirit beads and one pendant, kicks in the "buy 3 get free shipping" coupon ... which - b/c they're each currently in their own category, yields an $8-off for spirit beads + another $8 off for pendants ... which correctly zeros the combined shipping cost of each category). YAY.

    The bad news is that in my testing, I determined that if I "Remove this item" from the cart & input a different configuration, both coupons persist (i.e., if I remove the 2 spirit beads and one pendant in the above example and then turn around and add - for example - 4 spirit beads ... the cart erroneously reports a $8+$8=$16 coupon amount, for an $8 shipping charge ... i.e., the customer gets an additional $8 off, to which they are not entitled).

    Note that this seems to only occur when "removing items from the cart" and then re-adding them. Not a great likelihood in a real-world setting, but still not the behaviour expected.

    I've pasted images of both the erroneous tally in the cart and the back-office coupon (the rest of the code you can get off the live site). I've left the live code as-is, in case you wish to have a look.

    Links to the two relevant pages: Spirit Beads and Native Pendants

    image

    image
  • fc_adamfc_adam FoxyCart Team
    @stk,

    Looking at that screenshot - you have the same coupon added twice through two different coupon codes. As the coupon is set to allow multiple codes from that same single coupon, both codes are valid and so neither would need to be removed.

    I now understand what you are trying to achieve though - and I don't think there is going to be an easy way to achieve it.

    As I understand it, you have two categories - both with a flat rate of $8 - and you want to clear out that shipping for whichever of the categories is present if a combined 3 products or more are present in the cart.

    So if there is 2 products - either from a single category or from both, the flat rate shipping would stay - but if there is 3 or more products from one category, you want to discount by $8, or if there is 3 or more products from both categories combined, you want to discount by $16.

    I'm not sure we'll have a perfect solution for that with our native functionality right now, as our coupon functionality doesn't have an idea of how many categories are represented. And unfortunately we don't allow you to set up the coupon to base the discount tiers on a certain grouping of products, but only apply the discount amount to a separate grouping of products.

    I think the only way you'll be able to handle it natively right now is either to have all the products within the same category, or have separate coupons per category, and have the free shipping only apply if there is 3 or more within the single category.

    You could set up custom flat rate shipping with a snippet, and then check for the presence of coupons and apply free shipping using that. You would need to handle all of the shipping within the snippet though - so you wouldn't handle it within the categories at all. You also wouldn't need to apply a discount using the coupons either, but alter the custom shipping amount if they're present.

    Could either of those solutions work for the store?
  • stkstk Member
    edited March 2016
    @fc_adam wrote - "I think the only way you'll be able to handle it natively right now is either to have all the products within the same category,"

    Yes, as I wrote earlier, "Our second (and most current) strategy is to create categories based along shipping fees. So, in the case of the products we're rolling out first - Spirit Beads, Native Pendants & Sterling Silver Chains (all have relatively low-prices & are small in size) we're putting them all into one category (low-cost jewellery) which allows us a workaround for what seems to be a limitation in how shipping fees are handled."

    As you can see though, we're still learning how to "fly" the FoxyCart plane (hence some of the syntax issues, which we appreciate your patience in explaning, as it's helped us gain a better handle on the flight controls. To wit, thanks for pointing out the multi-coupon bit. I see now how that will affect what I'm seeing in the cart. For some reason, I wasn't twigging about that.

    Your discussion confirms our initial concerns regarding coupon/shipping limitations. While categorizing products along shipping fees appears the best way around these limitations, it doesn't make much organizational sense from a store-front point-of-view. My concern is that these cross-category shipping & discount problems will compound as we begin to add other products having radically different shipping fees (premium gold jewellery & engagement rings - small, expensive & relatively light; heavy - but relatively inexpensive - boxes of paint gun pellets, etc.)

    I am hoping by the time that we get around to adding some of these things, that FoxyCart will have created more tools that can be brought to bear on this "mattress store" shipping problem!

  • fc_adamfc_adam FoxyCart Team
    @stk,

    That does indeed sound like quite a complex range of products to be shipping! Let us know if we can help with anything else.
Sign In or Register to comment.