Actually on the discount list on admin page, all discounts enabled or not are listed.
But if we have created a lot of item :

  • new items are on the last page - I can override the views to list enabled discount on top of the list
  • we can't filter with the created date of the discount element

It will be great if we can show on top list : lastest items created and items enabled

Comments

bojanz’s picture

Ouch, we currently don't have a "created" column at all for discounts, so we need to add that first.

(At the same time, rename "enabled" to "status" and "status" to "export_status" since it is currently confusing).

vasike’s picture

Status: Active » Needs review
StatusFileSize
new19.68 KB

here is patch that:
- adds the new column "created" to discount schema
- change fields : rename "enabled" to "status" and "status" to "export_status"
- Update the Discounts view to include de changes + new sortable Created field in the Views
- others required by schema changes.

- About filtering the view on creation date, i can't see why it's needed, i think sorting for this field it's enough.
- if this "created" it's needed, then isn't also "updated" needed (i'm not sure created/updated are really needed here)?
- maybe a tagging of discounts could help for filtering.

jkuma’s picture

Status: Needs review » Needs work

Very good patch!

From my perspective, we have enough filters in the discount UI. The "created" field can be useful for sorting the view, but I don't think it's relevant to expose it as a filter. I don't think we need a "updated" field....

Moreover, if you put yourself in merchant's shoes, the following filters are relevant according to me:

  • Discount title (not implemented yet). It would be nice if we can expose a filter to search by discount title through a textfield element.
  • Discount type (ok)
  • Offer type (ok)
  • Discount status (ok). Did you rename the filter label with "status" instead of "enabled"?

May you remove the updated field, fix some comments error 'description' => 'The Unix timestamp when the product was created.', and expose that filter to search by discount title?

vasike’s picture

Status: Needs work » Needs review
StatusFileSize
new14.8 KB

re-worked the patch:
- keep renaming in discounts schema and thier changes
- get rid off created and its changes
- add name filter for the discounts view (nice to have Views Autocomplete Filters)

definitely this issue needs other title (have no inspiration right now).

jkuma’s picture

Here is an another attempt, I've changed some view's parameters, fix some CSS rules...

jkuma’s picture

Title: Add a filter on the discount on the Back-office with date of creation » Refactor discount view filters and alter schema
vasike’s picture

Status: Needs review » Needs work

with the last patch (#5) i got an error when i run the update and the Discounts seems unusable:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.enabled' in 'field list': SELECT base.discount_id AS discount_id, base.name AS name, base.label AS label, base.type AS type, base.enabled AS enabled, base.status AS status, base.module AS module, base.component_title AS component_title FROM {commerce_discount} base WHERE (base.status IN (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2)) ; Array ( [:db_condition_placeholder_0] => 3 [:db_condition_placeholder_1] => 2 [:db_condition_placeholder_2] => 6 ) in EntityAPIController->query() (line 187 of /d7path/sites/all/modules/entity/includes/entity.controller.inc).

i can't see where the "enabled" it's hooked.

vasike’s picture

Status: Needs work » Needs review
StatusFileSize
new19.81 KB

patch updated to avoid the error from previous post (rebuild the schema).

jkuma’s picture

Status: Needs review » Reviewed & tested by the community

Solves the issue raised on #7 and it's working like a charm.

jkuma’s picture

Status: Reviewed & tested by the community » Fixed

Committed in 7.x-1.x-dev branch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jenlampton’s picture

Category: Feature request » Bug report
Priority: Normal » Major
Issue summary: View changes
Status: Closed (fixed) » Needs work

I'm still getting the PDO error from #7 while running the lastest dev. Clearing all caches, the page cache, or the class registry will trigger the following:

The website encountered an unexpected error. Please try again later. 

and doing the same via drush from the command line shows:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.enabled' in 'field list': SELECT base.discount_id AS [error]
discount_id, base.name AS name, base.label AS label, base.type AS type, base.enabled AS enabled, base.status AS status, base.module AS
module, base.component_title AS component_title
FROM 
{commerce_discount} base
WHERE  (base.status IN  (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2)) ; Array
(
    [:db_condition_placeholder_0] => 3
    [:db_condition_placeholder_1] => 2
    [:db_condition_placeholder_2] => 6
)
 in EntityAPIController->query() (line 187 of drupal-7/sites/all/modules/contrib/entity/includes/entity.controller.inc).
jenlampton’s picture

Category: Bug report » Feature request
Priority: Major » Normal

hm, well truncating the cache_bootstrap and cache tables seemed to solve the problem.

jkuma’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Horroshow’s picture

Status: Closed (fixed) » Active

#13 Tried to truncate cache and cache_bootstrap but still getting the PDO Exception error when flushing the cache.

jkuma’s picture

Did you try to run the module updates ? (drush dbupdate)

jkuma’s picture

Status: Active » Postponed (maintainer needs more info)

Also what kind of PDO exception did you get during the flushing of caches?

larsjohnson’s picture

I also get (that) a PDO just as today when trying to flush:

WD php: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown[error]
column 'base.enabled' in 'field list': SELECT base.discount_id AS
discount_id, base.name AS name, base.label AS label, base.type AS
type, base.enabled AS enabled, base.status AS status, base.module AS
module, base.component_title AS component_title
FROM 
{commerce_discount} base
WHERE  (base.status IN  (:db_condition_placeholder_0,
:db_condition_placeholder_1, :db_condition_placeholder_2)) ; Array
(
    [:db_condition_placeholder_0] => 3
    [:db_condition_placeholder_1] => 2
    [:db_condition_placeholder_2] => 6
)
 in EntityAPIController->query() (line 187 of ../entity.controller.inc).

It has to do something with the commerce discount module, disabling this module does make the error go away.

caspervoogt’s picture

@larsjohnson it appears commerce_coupon still has some code in flux with regard to changing "enabled" to "status" . I tried fixing these but a maintainer would be better placed to review this. Suffice it to say commerce_coupon is incorrectly referencing "enabled" in some places where it should reference "status" instead. Look for:

->propertyCondition('enabled', TRUE)

and changed to:

->propertyCondition('status', TRUE)

That solved the errors with regard to Commerce Discount, however I am still unable to add a coupon ... due to apparent changes to the code field .. now called "data" ??

larsjohnson’s picture

thanks there is also a patch on comment #8 for commerce_discount that should be applied to commerce_discount alpha

larsjohnson’s picture

@plethoradsign i think you can do coupons with line items, some of well at least one of the modules isnt compatible with commerce_k2 it should be the same thing c_k2 does have the updated commerce_discount but it doesnt have include a c_coupon references can be all over the place

caspervoogt’s picture

Well, I was only using Kickstart2 to confirm my issues.. on my actual site where I'm having issues I don't use Kickstart2. So when I modified commerce_coupon.module, I was doing that without Kickstart2.

I think I may have already tried the patch from #8 but not sure, and may retry. I temporarily gave up on coupons and just created some new recurring products with lower prices but will give the patch from #8 a try if my customer finds a need for coupons again.

joelpittet’s picture

Status: Postponed (maintainer needs more info) » Fixed

Closing this issue out, for clean-up

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.