Jump to:

2081 Posts in 1001 Topics by 452 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Missing Sort column

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1097 Views
  • wildflower1975
    Avatar
    Community Member
    59 Posts

    Missing Sort column Link to this post

    Hi Jedateach and others

    I've got a little further in debugging my 3.0.3 SSCart issues

    I had forgotten about Director::set_environment_type("dev"); and was doing it the hard way

    I end up with this after setting the Director

    Couldn't run query: SELECT DISTINCT "OrderAttribute"."ClassName", "OrderAttribute"."Created", "OrderAttribute"."LastEdited", "FlatTaxModifier"."TaxType", "OrderAttribute"."ID", CASE WHEN "OrderAttribute"."ClassName" IS NOT NULL THEN "OrderAttribute"."ClassName" ELSE 'OrderAttribute' END AS "RecordClassName", "Sort" FROM "OrderAttribute" LEFT JOIN "FlatTaxModifier" ON "FlatTaxModifier"."ID" = "OrderAttribute"."ID" WHERE ("FlatTaxModifier"."ID" = 6) AND ("OrderAttribute"."ClassName" IN ('FlatTaxModifier')) ORDER BY "Sort" ASC, "OrderAttribute"."Created" ASC LIMIT 1 Unknown column 'Sort' in 'field list'

    I'm not sure where to start looking for this statement, as I'm sure it's put together automatically.

    I don't want to just add the sort column if it's been taken out on purpose, or maybe my dev/build didn't pick it up correctly?

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Missing Sort column Link to this post

    This would typically be fixed by a dev/build?flush=1, if there isn't a bug.

    Did you do anything special to get this bug? when does it occur?

    Looks like it's occurring when tax is being calculated.

  • wildflower1975
    Avatar
    Community Member
    59 Posts

    Re: Missing Sort column Link to this post

    I've managed to add a product to my cart form the product page and then I want to view my cart so I can do the checkout process.

    the SideCart include template works and I can see the product in my cart on the product page,

    (I haven't looked for the SideCart on a Category page)

    I had to add the cart page myself as the first dev/build after copying th code to my silverstripe dir didn't create one automatically (I'm not sure if it can?)

    Calculating Tax makes sense in that the Cart.ss is trying to draw a table with all the modifiers etc in it.
    I'm probably missing some default Modifier/Tax values.

    This is all on a fresh 3.0.3 install with no pre-exisiting anything.

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Missing Sort column Link to this post

    I haven't actually tested out the modifiers on ss3, so that is likely where the issue is occurring.

  • wildflower1975
    Avatar
    Community Member
    59 Posts

    Re: Missing Sort column Link to this post

    I've found the sort column on the OrderModifier class - its an INT type.

    when I try to run the erroring SQL directly in MySQL Workbench or phpmyadmin I ended up with a different syntax error, it didn't like the . between the table and column name in separate double quotes "

    SELECT DISTINCT "OrderAttribute.ClassName", "OrderAttribute.Created", "OrderAttribute.LastEdited", "FlatTaxModifier.TaxType", "OrderAttribute.ID", CASE WHEN "OrderAttribute.ClassName" IS NOT NULL THEN "OrderAttribute.ClassName" ELSE 'OrderAttribute' END AS "RecordClassName", "Sort" FROM OrderAttribute LEFT JOIN FlatTaxModifier ON "FlatTaxModifier.ID" = "OrderAttribute.ID" WHERE ("FlatTaxModifier.ID" = 6) AND ("OrderAttribute.ClassName" IN ('FlatTaxModifier')) ORDER BY "Sort" ASC, "OrderAttribute.Created" ASC LIMIT 1;

    works but there's no result.

    I'm hoping DB::query strips out those extra "

  • wildflower1975
    Avatar
    Community Member
    59 Posts

    Re: Missing Sort column Link to this post

    What it is is that there isn't the join from OrderModifier.ID = OrderAttribute.ID in the query to find the SORT column

    OrderModifier extends OrderAttribute

    I'm guessing extending something doesn't automatically put a JOIN in the ORM layer

    I have vague recollections of stating the join in the public static things (variables?) at the start of the class definition.

    I'll need to read the docs again

  • Nobrainer Web
    Avatar
    Community Member
    134 Posts

    Re: Missing Sort column Link to this post

    I just found this post, as i run into the same problem with the version 1.0 (for ss3.1) of
    https://github.com/burnbright/silverstripe-shop

    Created issue here:
    https://github.com/burnbright/silverstripe-shop/issues/196

    Did anyone ever figure out how to solve this problem?

    1097 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.