1999 Posts in 530 Topics by 433 members
|Go to End|
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?
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.
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.
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.
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 "
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
|Go to Top|