| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
customizing orders_list with colors | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
customizing orders_list with colors
so I've added two customizations to the admin orders_list page using the following:
skins/custom_skin/admin/en/header/body.tpl PHP Code:
and skins/custom_skin/admin/en/body/footer.tpl PHP Code:
I cannot for the life of me seem to be able to figure out how to get the colorizer to re-fire off after the reload once the user chooses a pagination option, or initiates a search anyone know how I would be able to do so?
__________________
-- Scott Godin |
|||||||||
#2
|
|||||||||
|
|||||||||
Re: customizing orders_list with colors
Hello Scott,
First of all, you should not inject CSS and JS code into HTML templates. You should use getCSSFiles() and getJSFiles() methods of widgets which require your code: - http://kb.x-cart.com/display/XDD/Adding+CSS+and+JS+files - http://kb.x-cart.com/display/XDD/Working+with+footer As for making your JavaScript code being executed after a pager reload - there are two main ways of doing this: - implementing your controller object extending the AController object (search for "AController" for examples that should look like "extend(ListsController, AController);") - using "microhandlers" (search for "core.microhandlers.add" for examples).
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#3
|
|||||||||
|
|||||||||
Re: customizing orders_list with colors
Quote:
Firstly, http://kb.x-cart.com/display/XDD/Working+with+footer is irrelevant -- I am not trying to change the footer. I had used the footer template in which to place my javascript solely because currently your system seems to load all the js files immediately after <body>, not either in immdiately before </body> as conventional wisdom suggests, nor immediately before the end of </head> so in order to get my script to run, I had to place it somewhere AFTER jquery loaded. and it was done this way because when i inquired previously about adding code specifically and solely to orders_list page, I was told Quote:
...i.e. BEFORE jquery loads, the way you currently do things. oops. jump back one list in the page to http://kb.x-cart.com/display/XDD/Adding+custom+JavaScript+code+to+the+page and you can see why I added js where and why I did. regarding the rest of your message: it looks as though skins/admin/en/items_list/model/table/controller.js is the one that handles the reload of the content on orders_list but that ALSO doesn't look specific to orders_list exclusively. I do not wish to affect any other tables within the system. I was not thinking in terms of implementing additional MVC code in a module to extend this functionality when I could merely do this in the templating with an additional loop, or even more simply with a smattering of js to 'paint' the surfaces after the page content loads. Except, you don't appear to be using AJAX to reload the page content on click of search or pagination, as I am not catching any ajaxComplete events. I don't mind trying to do this as a module (though TBH it feels like overkill), but I would need to know more about what to attach to. Since all I need to know is how to trigger it for pagination and search events, wouldn't that be the simpler answer, even if this is not currently the *best overall solution*, it's faster to implement for the client, no ? Seeing as I already have this partially working and we're already there, and all.
__________________
-- Scott Godin |
|||||||||
#4
|
|||||||
|
|||||||
Re: customizing orders_list with colors
A bit of an angry post it seems?
I'm *assuming*, from the way you write that you are are from the UK? Perhaps the odd Please or Thanks could help the answers come in? It's just that abruptness, anger and bad manners are my pet hates I'm afraid. Sorry I cannot contribute a solution. Kind regards ITVV (From the UK)
__________________
X-Cart Pro 4.7.12 Active and working great with reBOOT-reDUX X-Cart Pro 4.6.6 Retired after 6 years of first class service X-Cart Pro 4.1.7 Retired after 9 years of first class service Apache: 2.4.25 PHP: 7.4.5 MariaDB: 10.1.44 Arch: x86_64 |
|||||||
#5
|
|||||||||
|
|||||||||
Re: customizing orders_list with colors
No not at all and you are reading way more emotion into my response than was there;
no anger at all, Simple matter-of-factness along with a touch of "this has already been going on behind the forum scenes in x-cart support (wherein one day passes between post and reply each time) and the answer I received here is in apparent contradiction to information I received both there and explicitly one page back from the knowledgebase article in the reply, so huh?" confusion. please, let's keep to the facts here, and thank you for your time
__________________
-- Scott Godin |
|||||||||
|
#6
|
|||||||||
|
|||||||||
Re: customizing orders_list with colors
I was able to figure things out eventually, and it appears that jquery ajaxStop() fires at the appropriate time for me to add a call to recolorize the rows
Code:
But I had to move the following two variable declarations inside the function, so that they properly reflect the current state of the table at the time of the call Code:
now I can factor out the lines that add a css-background-color and just leave the classes, and then spend some time customizing the CSS so that we can have useful foreground colors that don't clash visually with the respective backgrounds, for the rest of the table elements on the row
__________________
-- Scott Godin |
|||||||||
#7
|
|||||||||
|
|||||||||
Re: customizing orders_list with colors
Hello Scott,
It is up to you how you implement the changes, however what I suggest is the proper way of coding changes that gives you the maximum compatibility with future versions of X-Cart 5. The recommended way of adding your JavaScript files is creating a module and decorating the getJSFiles() method in the widget class that renders the block that your code will work with. I believe for orders it is the \XLite\View\ItemsList\Model\Order class. As for making your code triggered after the page load and/or after an Ajax update of the widget: you should either write your own JS object "extended" from AController object, or use the "decorate()" function to extend functions of an existing JS object extended from AController, or use microhandlers. If the logic is simple, I would look into using microhandlers. Using jQuery events may work (and will likely work), but there is no guarantee that it won't conflict with other modules (and with future versions of X-Cart 5).
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#8
|
|||||||||
|
|||||||||
Re: customizing orders_list with colors
Quote:
It is not for orders in general; it is instead HIGHLY specific to the admin-side orders_list page exclusively. I suppose it could also be added to the dashboard so that the list of orders shown there can share the color scheme used at orders_list, and I would probably add that in when I get to the point that I'm ready for a module for this. Quote:
If there were more extensive tutorials out there with regards to specifically these things, that went into greater detail for those of us who, while not familiar with these practices, can figure it out given enough detail... That having been said, I do plan at some point down the road to make this into a module, that will allow the setting of colors for the rows, on the admin side, and will at that point use getJSFiles() and getCSSFiles() in the code therein. However it would take me twice as long to figure out how to do that at THIS point in time where I am still learning the internals, and that's not conducive to rapid prototyping this so as to resolve the client issue so we can move forward with the many other things that are part of a large work-order specification for modifications to the system that will be performed by the x-cart team. Quote:
The only thing the code I have written does, is wait til x-cart has done everything else it needs to and is _finished_, and then I go traipse thru the table and add classes based on the values of the two dropdowns. The only potential conflict I can see here is if you rename the classes that the selectors in the script are based on, which will only necessitate my re-examining your code and determining a new selector. And if it 'breaks', the only thing that will occur is that the rows won't get colorized. All THAT having been said, I am very interested in learning more about all three methods {A, B, C} that you mention above... where can I find out more about these in much greater detail? tutorials, walkthroughs, and the like? Don't think I don't appreciate your suggestions...I do. It's just that other aspects of this project have already gone on too long, and there's not enough time right now for me to learn how to do a new thing (or several new things) while the rest of the ongoing work holds up and waits for me to finish.
__________________
-- Scott Godin |
|||||||||
#9
|
|||||||||
|
|||||||||
Re: customizing orders_list with colors
Quote:
Will the \XLite\View\ItemsList\Model\Order\Admin\AAdmin class work? Quote:
Unfortunately, there is no detailed documentation on the JavaScript part of the source code. You have to look through the existing code and use it as the example. Quote:
I would look into using "microhandlers". Just make your JavaScript file loaded with getJSFiles() and put the logic into a function added as follows: Code:
For more complex cases you can use the AController object: Code:
If you need to replace a method of an existing controller object, you can use this: Code:
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#10
|
|||||||||
|
|||||||||
Re: customizing orders_list with colors
Quote:
interestingly, when I search for "core.microhandlers.add" the _only_ thing that comes up on google is this post. searching the code will only get one so far, without more comprehensive explanatory documentation around the web.
__________________
-- Scott Godin |
|||||||||
|
|||
X-Cart forums © 2001-2020
|