Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

E-Commerce Modules /

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

Missing Sort column


Reply


7 Posts   1248 Views

Avatar
wildflower1975

Community Member, 59 Posts

10 December 2012 at 10:02pm

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?

Avatar
Jedateach

Forum Moderator, 232 Posts

11 December 2012 at 2:01pm

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.

Avatar
wildflower1975

Community Member, 59 Posts

11 December 2012 at 2:18pm

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.

Avatar
Jedateach

Forum Moderator, 232 Posts

11 December 2012 at 4:41pm

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

Avatar
wildflower1975

Community Member, 59 Posts

11 December 2012 at 8:26pm

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 "

Avatar
wildflower1975

Community Member, 59 Posts

11 December 2012 at 8:52pm

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

Avatar
Nobrainer Web

Community Member, 137 Posts

14 November 2013 at 12:53am

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?