Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product class #6370

Merged
merged 1 commit into from May 24, 2024
Merged

Product class #6370

merged 1 commit into from May 24, 2024

Conversation

drbyte
Copy link
Member

@drbyte drbyte commented Apr 3, 2024

Centralizes all basic product-related querying and overriding. (Not including attributes or pricing.)

Closes #6367

The easiest override/notifier hook is now NOTIFY_GET_PRODUCT_OBJECT_DETAILS

@drbyte

This comment was marked as resolved.

@proseLA

This comment was marked as resolved.

@drbyte

This comment was marked as resolved.

@proseLA

This comment was marked as resolved.

@drbyte

This comment was marked as resolved.

@drbyte
Copy link
Member Author

drbyte commented May 17, 2024

Despite this PR touching a lot of files, I think it certainly improves the consistency across the many places where product data is rendered, instead of the sometimes wildly different ways of outputting things.

Ready for deeper review IMO.

Of course, if something needs refining let's discuss it and polish things.

@proseLA
Copy link
Sponsor Contributor

proseLA commented May 17, 2024

i am currently building a new site that makes use of this unreleased PR. which is how i found the error from 4/24 involving the admin and language.

i just noticed a new warning today. that comes from here:

$this->EOF = false;

i think following that code should be something like:

if (empty($this->data)) {
    $this->EOF = true;
}

the error gets triggered by something like:

zen_get_products_type(66699585);

where 66699585 is an invalid product_id.

i am a BIG fan of this PR as i agree that it improves consistency and makes developers lives easier; at least those developers that employ modifications to a product object.

@drbyte
Copy link
Member Author

drbyte commented May 17, 2024

i think following that code should be something like:

Yes, you're right. Good catch. Thanks.

I should probably actually go refactor all those legacy functions to no longer use the legacy fallbacks ... cuz there's no point depending on them. And one can go back to the PR/commit to see what the code was "before" the refactoring if they wanna see how to implement the changes in their own code.

@drbyte
Copy link
Member Author

drbyte commented May 17, 2024

I'm opting for: $this->EOF = empty($this->data); for accuracy.

@drbyte drbyte force-pushed the product_class branch 2 times, most recently from f2ca165 to 1afa3c7 Compare May 18, 2024 00:44
@drbyte
Copy link
Member Author

drbyte commented May 18, 2024

I did some refactoring to functions_products.php and shopping_cart.php class, to avoid using the deprecated syntax that relied on queryFactory results that were used before centralizing these queries into the Product class.

lat9
lat9 previously requested changes May 20, 2024
Copy link
Contributor

@lat9 lat9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use existing notification for downward compatibility.

includes/classes/Product.php Show resolved Hide resolved
@lat9 lat9 dismissed their stale review May 21, 2024 00:08

Invalid, see conversation.

@drbyte drbyte force-pushed the product_class branch 2 times, most recently from df825a8 to 2081c67 Compare May 22, 2024 21:17
Centralizes all basic product-related querying and overriding.
(Not including attributes or pricing.)

Closes zencart#6367

The easiest override/notifier hook is now `NOTIFY_GET_PRODUCT_OBJECT_DETAILS`
@scottcwilson
Copy link
Sponsor Contributor

The merge of #6473 means this PR must go into 2.1.0. Changing label.

@drbyte drbyte merged commit fb33cb2 into zencart:master May 24, 2024
8 checks passed
@drbyte drbyte deleted the product_class branch May 24, 2024 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

making product name consistent across the repo....
4 participants