Zen Cart Logo
Forums / Upgrading to 1.5.x / Functions removed from 1.5.8 - discussion

Functions removed from 1.5.8 - discussion

Views: 2,112

Results 1 to 10 of 10
2 Dec 2022, 11:24 AM
#1
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,703
Plugin Contributions:
56

Functions removed from 1.5.8 - discussion

During what might have been overzealous culling, the following functions were removed from the code base in 1.5.8.

  • zen_draw_products_pull_down
  • zen_draw_products_pull_down_attributes
  • zen_draw_products_pull_down_categories
  • zen_draw_products_pull_down_categories_attributes

Did this hit one of your plugins? Please comment below.

2 Dec 2022, 7:38 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Functions removed from 1.5.8 - discussion

It will in stock by attributes in one place, I expect to use a function_exists test to work around that issue, though need to look at how the feature is now implemented.

Github location of what will be problematic is: https://github.com/mc12345678/Stock_By_Attributes_Combined/blob/a0f94d35d531a77680ded4f26f4432003eba31ca/admin/products_with_attributes_stock.php#L1489

3 Dec 2022, 12:16 AM
#3
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,962
Plugin Contributions:
8

Re: Functions removed from 1.5.8 - discussion

swguy:

During what might have been overzealous culling, the following functions were removed from the code base in 1.5.8.

  • zen_draw_products_pull_down
  • zen_draw_products_pull_down_attributes
  • zen_draw_products_pull_down_categories
  • zen_draw_products_pull_down_categories_attributes

Did this hit one of your plugins? Please comment below.

i would disagree with the assessment of "overzealous culling."

it seems these functions were merely renamed. their function signatures remain unchanged.

see this commit.

3 Dec 2022, 1:19 AM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,703
Plugin Contributions:
56

Re: Functions removed from 1.5.8 - discussion

Thanks for tracking that down.
We might want to have a compatibility layer so that plugins won't be broken. We could issue a deprecated log. Will noodle on it.

3 Dec 2022, 11:53 AM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,703
Plugin Contributions:
56

Re: Functions removed from 1.5.8 - discussion

LOL in the original PR #4083 created by @drbyte, I said, "uhh... we'll break plugins," and Cindy agreed.

PR #5439 created.

3 Dec 2022, 5:57 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,703
Plugin Contributions:
56

Re: Functions removed from 1.5.8 - discussion

OK PR 5439 has been merged, so this will be the resolution.

If you are upgrading a plugin and need these functions, please see
https://github.com/zencart/zencart/pull/5439/files

3 Dec 2022, 6:33 PM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,703
Plugin Contributions:
56

Re: Functions removed from 1.5.8 - discussion

If you are writing software to run on both Zen Cart 1.5.8 and older versions, you can use function_exists to determine the correct function to call, or you can use version checking logic:

https://docs.zen-cart.com/dev/plugins/version/

10 Dec 2022, 1:56 PM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Functions removed from 1.5.8 - discussion

mc12345678:

It will in stock by attributes in one place, I expect to use a function_exists test to work around that issue, though need to look at how the feature is now implemented.

Github location of what will be problematic is: https://github.com/mc12345678/Stock_By_Attributes_Combined/blob/a0f94d35d531a77680ded4f26f4432003eba31ca/admin/products_with_attributes_stock.php#L1489

swguy:

If you are writing software to run on both Zen Cart 1.5.8 and older versions, you can use function_exists to determine the correct function to call, or you can use version checking logic:

https://docs.zen-cart.com/dev/plugins/version/

I accomplished this using the following: https://github.com/mc12345678/Stock_By_Attributes_Combined/commit/a8341e6d4a5775d024af263dc175a7eb5934f1b0

10 Dec 2022, 5:06 PM
#9
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,703
Plugin Contributions:
56

Re: Functions removed from 1.5.8 - discussion

Very elegant! I didn't even know function pointers were a thing in PHP.

I think this might be too complicated for the documentation, but thanks for sharing it.

10 Dec 2022, 7:52 PM
#10
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Functions removed from 1.5.8 - discussion

swguy:

Very elegant! I didn't even know function pointers were a thing in PHP.

I think this might be too complicated for the documentation, but thanks for sharing it.

Technically termed variable functions: https://www.php.net/manual/en/functions.variable-functions.php

And in this case seemed like a suitable method considering the function definition was the same for both. Otherwise might get complicated if individual if statements were used within the call or might have gotten busy if two separate calls were captured in an if/else situation