Code Monkey home page Code Monkey logo

Comments (8)

bymayo avatar bymayo commented on June 24, 2024 1

@AugustMiller Ahh yes - I think this is due to Commerce changing the way plans are referenced (https://github.com/craftcms/commerce/blob/develop/CHANGELOG-v2.md#security) I'll push a fix for this tomorrow.

from craft-commerce-widgets.

bymayo avatar bymayo commented on June 24, 2024 1

@AugustMiller I think hiding widgets that don't apply is a good idea! I'll be pushing a fix for this later this week :)

from craft-commerce-widgets.

bymayo avatar bymayo commented on June 24, 2024

@AugustMiller I can't seem to replicate this issue. I've hit you up on Slack but doesn't look like you've been on. If you can jump on there or post more details in here we can solve this 💪

from craft-commerce-widgets.

AugustMiller avatar AugustMiller commented on June 24, 2024

This is embarrassing—I think I'd only tried this on a site without any subscriptions configured?

Unfortunately, I can't get a test subscription set up at the moment, but I'm curious to know whether emptying your available Subscriptions produces the same error?

Edit: Probably worth investigating for the ding-dongs like me who click around hastily, and might inadvertently take down their dashboard 😉 (Or maybe hiding the widgets that don't apply to the apps where it's installed?)

from craft-commerce-widgets.

AugustMiller avatar AugustMiller commented on June 24, 2024

FYI—tried a few more widgets, and even relevant ones seem to generate SQL errors.

It seems most errors are just mismatched column names, or potentially issues with case-sensitivity?

For context, this app uses Postgres—apologies for not mentioning this in the original issue!

from craft-commerce-widgets.

bymayo avatar bymayo commented on June 24, 2024

@AugustMiller I'll run tests using a Postgres database then - But could you paste some of the errors your getting in to this issue?

from craft-commerce-widgets.

AugustMiller avatar AugustMiller commented on June 24, 2024

So sorry this has dragged on! 😥

Got a couple messages for you—overall, it seems like the case sensitivity in Postgres is responsible for most of these?

bymayo\commercewidgets\widgets\ProductsTop::getProducts()

SQLSTATE[42703]: Undefined column: 7 ERROR: column items.purchasableid does not exist
LINE 3: ...purchasables" "purchasables" ON purchasables.id = items.purc...
^
HINT: Perhaps you meant to reference the column "items.purchasableId".
The SQL being executed was: SELECT "variants"."productId" AS "id", "variants"."sku" AS "sku", SUM(items.total) as totalRevenue, count(*) as totalOrdered
FROM "commerce_lineitems" "items"
LEFT JOIN "commerce_purchasables" "purchasables" ON purchasables.id = items.purchasableId
LEFT JOIN "commerce_variants" "variants" ON variants.id = purchasables.id
GROUP BY "items"."purchasableId"
ORDER BY "totalRevenue" DESC
LIMIT 5

bymayo\commercewidgets\widgets\TotalRevenueOrders::getRevenueOrdersRow(['label' => 'Today', 'date' => '03 Dec 2018'])

SQLSTATE[42703]: Undefined column: 7 ERROR: column orders.totalprice does not exist
LINE 1: SELECT COALESCE(sum(orders.totalPrice), 0) as totalRevenue, ...
^
HINT: Perhaps you meant to reference the column "orders.totalPrice".
The SQL being executed was: SELECT COALESCE(sum(orders.totalPrice), 0) as totalRevenue, COALESCE(count(orders.id), 0) as totalOrders
FROM "commerce_orders" "orders"
WHERE ("orders"."isCompleted"=1) AND (DATE_FORMAT(orders.dateCreated, "%Y-%m-%d")='2018-12-07')
LIMIT 1

bymayo\commercewidgets\widgets\TopCustomers::getCustomers()

SQLSTATE[42703]: Undefined column: 7 ERROR: column orders.totalprice does not exist
LINE 1: SELECT count(*) as totalOrders, SUM(orders.totalPrice) as to...
^
HINT: Perhaps you meant to reference the column "orders.totalPrice".
The SQL being executed was: SELECT count(*) as totalOrders, SUM(orders.totalPrice) as totalRevenue, "orders"."email", "orders"."customerId"
FROM "commerce_orders" "orders"
WHERE "orders"."isCompleted"=1
GROUP BY "orders"."email"
ORDER BY "totalOrders" DESC
LIMIT 5

bymayo\commercewidgets\widgets\Goal::getTotals()

SQLSTATE[42703]: Undefined column: 7 ERROR: column orders.totalpaid does not exist
LINE 1: ...OALESCE(count(*), 0) as totalOrders, COALESCE(SUM(orders.tot...
^
HINT: Perhaps you meant to reference the column "orders.totalPaid".
The SQL being executed was: SELECT COALESCE(count(*), 0) as totalOrders, COALESCE(SUM(orders.totalPaid),0) as totalRevenue
FROM "commerce_orders" "orders"
WHERE (WEEK(orders.datePaid)='49') AND (YEAR(orders.datePaid)='2018')
LIMIT 1

bymayo\commercewidgets\widgets\SubscriptionPlans::getSubscriptionPlans()

SQLSTATE[42703]: Undefined column: 7 ERROR: column subscriptions.planid does not exist
LINE 3: ... JOIN "commerce_subscriptions" "subscriptions" ON subscripti...
^
HINT: Perhaps you meant to reference the column "subscriptions.planId".
The SQL being executed was: SELECT "plans".*, COUNT(subscriptions.planId) as activeSubscriptions
FROM "commerce_plans" "plans"
LEFT JOIN "commerce_subscriptions" "subscriptions" ON subscriptions.planId = plans.id
WHERE "plans"."isArchived"=0
GROUP BY "plans"."id"
ORDER BY "dateCreated" DESC
LIMIT 4

from craft-commerce-widgets.

bymayo avatar bymayo commented on June 24, 2024

@AugustMiller I'm having difficulties fixing this issue, as I've just installed the widgets on a fresh site that only has orders (No subscriptions) and the widgets / CMS doesn't error when enabling subscriptions widgets with no plans available.

Also with the Postgres errors, they do look like case errors, but looking at my queries i'm targeting them with the correct case (Not like it says in the error).

Is there any more information you can give, or if your happy to jump on Slack one day we can bash this error out a bit easier?

from craft-commerce-widgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.