Thanks Ryne.
I agree that a cartridge setting for it would be overkill, maybe some
changes to cartridge to present it a different way would be nice but as
variation options are so subjective I totally see why it works the way that
it currently does.
In the end I just monkey patched it to remove the variation from the
product name. The code to do so was pretty simple, in my_shop/models.py:
# Monkey patching! This will override the name of the product in the cart to
# produce a version without the variant name, instead this will be shown
via the SKU field.
def product_variation_str(self):
"""
Display the option names and values for the variation.
"""
result = u"%s" % (str(self.product))
return result.strip()
ProductVariation.__str__ = product_variation_str
Not ideal but it works well enough.
On Friday, November 4, 2016 at 7:31:25 PM UTC, Ryne Everett wrote:
>
> I agree that the current default behavior isn't great for everybody. I'm
> not thrilled by it myself but have lived with it so far.
>
> One approach would be to improve the default behavior in cartridge,
> though I don't have a proposal for a more generally acceptable format at
> hand.
>
> Another approach would be to add a cartridge setting for a function that
> formats this string, but I'm not sure that can be justified.
>
> Perhaps monkey-patching the ProductVariation.__str__ method would be the
> best approach. I don't think I've monkey-patched model methods before
> but you might come up with a sensible way to do it with experimentation
> and/or searching the web.
>
> Please give a report if you come up with anything.
>
> On 11/02/2016 05:20 AM, Pete Dermott wrote:
> > Hi Everyone,
> >
> > I'm looking to create a Cartridge store that offers the ability for
> > customers to buy low cost samples of our products, my thought was to
> > use the variations system to do so.
> >
> > However, when I get to the checkout the system puts the items in the
> > cart as $ProductName $ProductOptionType: $ProductOptionName so for
> > example, with my product option type of "Shippable" this turns into
> > "Product Name Shipable: Sample" which isn't really ideal.
> >
> > What I would like to do instead is remove the modification of the
> > product description and show the original description and a separate
> > field for the products SKU instead.
> >
> > I believe the modification to the name is taking place
> > incartridge.models.ProductVariation file's __str__ method
> > <
> https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/models.py#L229>
>
>
> > but I've got no idea how I can modify this without causing issues with
> > other parts of the site.
> >
> > What is my best option here?
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Mezzanine Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [email protected] <javascript:>
> > <mailto:[email protected] <javascript:>>.
> > For more options, visit https://groups.google.com/d/optout.
>
>
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.