mc12345678 / attribute_image_swap Goto Github PK
View Code? Open in Web Editor NEWKnown as: Attribute image replaces main product image on sel at: https://www.zen-cart.com/downloads.php?do=file&id=699
Known as: Attribute image replaces main product image on sel at: https://www.zen-cart.com/downloads.php?do=file&id=699
There are a few things that are not yet PHP 7.x fully functional that could use touching/improvement.
The install SQL could use a little more explanation within the file for those that are using this. There is really little that is needed to support the image swap; however, at some point there was an added feature incorporated that generates an attribute link. While not well understood, it does require a SQL statement and it appears if executed multiple times will produce multiple instances of the same thing.
While this could be better controlled with an installer, the software doesn't seem to have reached the level of maturity or need to requiring such an installer.
When setting the attribute image style to the added values of 6, 7, or 8, the text of these selection types incorporates a <br />
into the text and moves a portion to a new line. This is unexpected when switching to the image swap style from a value of 0, 1, or 2.
With IH5 installed, attempting to swap an image causes the image not to swap and results in an error on the catalog side similar to:
PHP Fatal error: Uncaught Error: Call to a member function notify() on null in ...\includes\modules\YOUR_TEMPLATE\main_product_image.php:19
Stack trace:
#0 ...\includes\classes\ajax\zcAttrib_prod_info.php(48): require_once()
#1 ...\ajax.php(76): zcAttrib_prod_info->swap_image()
#2 {main}
thrown in ...\includes\modules\YOUR_TEMPLATE\main_product_image.php on line 19
This is because the file includes\classes\ajax\zcAttrib_prod_info.php
incorporates the module file (require_once
) and within the file is a notifier that does not have $zco_notifier
defined. Therefore in order to support execution, $zco_notifier
needs to be brought into the execution space. As a global variable to ZC, perhaps the best solution is to simply make $zco_notifier
global within the calling function.
All things point to the fact that if the attribute image setting were 6 that the attribute's image would be displayed along with switching images as options were chosen.
The plugin zen_colorbox, available at https://www.zen-cart.com/downloads.php?do=file&id=1322 has undergone or shortly will undergo a slight change that would affect the colorbox feature. The principal change is in a file that could be incorporated with default values set and some of the returning values trimmed/parsed to remove excess JavaScript/jQuery. Ideally, when tagging onto another program, their interaction should be made more seamless and modular. Such a step should be taken here to possibly improve that code as well.
There's not really a need for language defines to be in the language file for the software being executed at least from a plugin portability stand point. It does reduce code usage and loading, but
makes installation more difficult.
The defines to display in the admin about the selections added by this plugin could be moved to a standalone file.
The table products_options
does not have the field products_options_types_id
. As a result when attempting to execute the removal sql, it fails.
#This plugin offers the ability to swap the attribute image into the main product image location; however, store owners may have also incorporated other image handling type software that would allow some other next action to occur with the main product image. Therefore, with that swap, the plugin should allow some level of control/generation to support continued operations such as the other plugin(s).
Note, that because the plugin only modifies screen information and not the database information related to a product, that image popup/display is through the combination of the main product image and additional images related code and not necessarily/through just the main product image code as seen in the tpl_modules_main_product_image.php file.
Generally speaking at this point, the plugin already considers the modified image "name" of say Image Handler v4, though may not include the popup on hover aspect (yet). A next image related plugin is zen_colorbox (https://github.com/mc12345678/zen-colorbox) the backbone of which continues to be supported by the open source community and is being updated to support plugins such as this relatively easily incorporating the operation(s).
So, keep an eye out for ways to either incorporate or for methods to be incorporated and support improved operation(s) and capabilities.
The install SQL if used (as it applies to "links") is in some cases spread across 2 or more lines. At least in testing with a local copy errors were produced. This may be/have been different for the uploaded copy; however, want to make the experience consistent.
Should join the multiple lines into one.
While this code seems to only really touch one core file, it is not easy to keep the installation clear about what needs changing and what needs simply to be replaced. It seems that it would be a little clearer if the code were split into folders where the core set of files are installed from one folder and the modified file(s) are in another.
This also would support the request of the software distribution team to not have sql related files and instruction files in the root of the software distribution package which means that those installing the software would likely have a cleaner installation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.