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

making product name consistent across the repo.... #6367

Closed
proseLA opened this issue Apr 2, 2024 · 3 comments · Fixed by #6369 or #6370
Closed

making product name consistent across the repo.... #6367

proseLA opened this issue Apr 2, 2024 · 3 comments · Fixed by #6369 or #6370

Comments

@proseLA
Copy link
Sponsor Contributor

proseLA commented Apr 2, 2024

in looking at the code for v200, it seems that one can successfully override the zen_get_products_name function without touching any of the base code. this is a change that i applaud. (thank you @torvista. change was done in this commit 759b64d.)

the override is done when the zen_get_products_name function calls the zen_get_product_details function as seen here:

//Allow an observer to modify details
$zco_notifier->notify('NOTIFY_GET_PRODUCT_DETAILS', $product_id, $product);
return $product;

unfortunately, for the majority of times a customer is displayed a product, the zen_get_products_name function is not used.

one such instance is on line 219 here:

$listing_product_name = $record['products_name'] ?? '';
$listing_description = '';
if ((int)PRODUCT_LIST_DESCRIPTION > 0) {
$listing_description = zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($record['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION);
}

due to the multi-lingual aspect of ZC, one can very easily override the products description, as the method zen_get_products_description as seen on line 222 is consistently used whenever calling the products description.

ideally if one were to want to change the construction of the product name as presented to the customer, one should be able to do it in 1 place; but and most importantly, do it WITHOUT changing any of the base zc code.

i see 2 potential solutions to this problem:

  • change all uses of the product name to call the zen_get_products_name function.
  • change all product listings to only retrieve the products_id, and then use the zen_get_product_details to retrieve all necessary information about the product.

i think the 2nd option affords more flexibility for more things. but i'm open on that... it seems the 1st option might be easier to implement.

does anyone have any thoughts? and or willingness to accept a PR if one were attempted?

@drbyte
Copy link
Member

drbyte commented Apr 3, 2024

this change works for all pages that make use of the product listing. but what about the centerboxes? the sideboxes? the shopping cart? some of these places make use of the method zen_get_product_details, ie the shopping cart, and some do not. in addition, some places, the change is available to be made without making a change to the core code... ie, this notifier NOTIFY_MODULES_FEATURED_PRODUCTS_B4_LIST_BOX allows me to change the name there... but why should i have to if it is already changed in the aforementioned function?

Can we assemble a list here of the known affected places? I'm going to look into the bigger picture of this this week, and having a bulleted list would be a little extra help to make sure I'm not missing an edge case.

You mentioned:

  • product listing (which now covers the SNAF pages too)
  • centerboxes
  • sideboxes
  • shopping_cart

@proseLA
Copy link
Sponsor Contributor Author

proseLA commented Apr 3, 2024

Can we assemble a list here of the known affected places?

i will certainly make an attempt!

drbyte added a commit to drbyte/zencart that referenced this issue Apr 3, 2024
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`
@drbyte drbyte mentioned this issue Apr 3, 2024
@proseLA
Copy link
Sponsor Contributor Author

proseLA commented Apr 3, 2024

this list is by no means exhaustive, but...

modules that use NOTIFY_GET_PRODUCT_DETAILS

  • page: shopping cart

  • page: checkout confirmation

  • centerbox: monthly specials

  • centerbox: also purchased

  • sidebox: notifications

  • sidebox: shopping cart

  • sidebox: quick re-order

modules that do NOT use NOTIFY_GET_PRODUCT_DETAILS

  • centerbox: featured products

  • centerbox: upcoming products

  • product listing: responsive classic

  • sidebox: bestsellers

  • sidebox: specials

  • sidebox: featured products

  • sidebox: new products

drbyte added a commit to drbyte/zencart that referenced this issue Apr 3, 2024
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`
drbyte added a commit to drbyte/zencart that referenced this issue Apr 4, 2024
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`
drbyte pushed a commit that referenced this issue Apr 6, 2024
* Use `zen_get_products_name` on listings

Fixes #6367
drbyte added a commit to drbyte/zencart that referenced this issue Apr 7, 2024
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`
drbyte added a commit to drbyte/zencart that referenced this issue Apr 7, 2024
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`
drbyte added a commit to drbyte/zencart that referenced this issue May 1, 2024
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`
drbyte added a commit to drbyte/zencart that referenced this issue May 15, 2024
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`
drbyte added a commit to drbyte/zencart that referenced this issue May 17, 2024
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`
drbyte added a commit to drbyte/zencart that referenced this issue May 18, 2024
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`
drbyte added a commit to drbyte/zencart that referenced this issue May 22, 2024
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`
drbyte added a commit to drbyte/zencart that referenced this issue May 22, 2024
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`
drbyte added a commit to drbyte/zencart that referenced this issue May 23, 2024
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`
drbyte added a commit to drbyte/zencart that referenced this issue May 24, 2024
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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants