Jump to content

Recommended Posts

Posted (edited)

SiteWide Hooks (Frozen).zip

 

These add in the possibility to easily track what versions you are using for external scripts (eg jquery, bootstrap etc).

This is coming this month in Edge.  If you want to try it on Frozen, download the zip and;

  1. make the changes in /includes/template_top.php
  2. make the changes in /includes/template_bottom.php
  3. upload the contents of /includes/hooks/

Open to constructive feedback and discussion.

 

 

 

 

Edited by burt
updated files in .zip (again)

This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Tried it, did not work at all for me. 

Does work when I got the files from github

Share this post


Link to post
Share on other sites

A link would help me to diagnose any potential problems.  Feel free to PM if you do not with to publicly divulge.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Looks like you haven't uploaded the amended (t_top and t_bottom) files...


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

I only tested on my local install on xampp, looking at the site source none of the hooks seemed to load at all, in the hooks in admin it showed the hook existed but none of the modules showed benneth that. 

I copied all the files in the includes folder

 

Share this post


Link to post
Share on other sites

moded fies so just added new line's

<?php
echo $OSCOM_Hooks->call('siteWide', 'BS_header');
echo $OSCOM_Hooks->call('siteWide', 'FA');
echo $OSCOM_Hooks->call('siteWide', 'SS');
echo $OSCOM_Hooks->call('siteWide', 'Shiv');
echo $OSCOM_Hooks->call('siteWide', 'JQ');

echo $oscTemplate->getBlocks('header_tags'); 
?>

 


 

Share this post


Link to post
Share on other sites

OK, thanks for testing (both).  I'll try it on a clean test site.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Ok, I tried on a clean test site...and yep...it was broken.  This is due to a dumb error on my part.

Could you move the "siteWide" folder as so:

/includes/hooks/siteWide/

TO:

/includes/hooks/shop/siteWide/

In other words, the "siteWide" folder should be in a "shop" folder, inside the "hooks" folder.

I'll update the zip now.  TY for testing @JcMagpie & @puddlec 


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

that did the trick.

image.png.029433a619a4672e82c94dc0b8e33e4d.png

 

what advantages are there in using the the hooks system.

in for example the hook for bootstrap it has $version = '3.3.7'; but within the admin i could not see anywhere that says the i am using bootstrap 3.3.7

Share this post


Link to post
Share on other sites

Excellent, thanks.

I suspect there might be some type of module upcoming to allow to see versioning ;)

 

 


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

As above now see in admin

image.png.d333481a49ece5eece8ccb4ac85316e3.png

But what is the point of this? An explanation of what your trying to do and what benefits it will have would be a good start.


 

Share this post


Link to post
Share on other sites
Posted (edited)

I'm thinking something like;

versioning.jpg.22eb0e82130bf56ba816ecf37ebb1582.jpg

eg in the admin > tools > security checks page

Pretty simple, yet makes things a lot easier all round.

In addition when wanting to update (eg FA from say 5.6.0 to 5.12.99)...shopowner just upload 1 file [ includes/hooks/shop/siteWide/fontAwesome.php ] and forget about it.

Can we see the possibilities this brings?

 

Edited by burt

This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

So what will this give over the normal and simple method of just using the browser inspection tool to see what resorces you are running?

 

image.png.1acd35ca73c2c4fee514f5aef63006a3.png


 

Share this post


Link to post
Share on other sites

I would think it's easier for most people to simply open up a page in admin, no?


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Here's hooks admin in a live shop.

image.thumb.png.139a3ac400c544b3e51d1051dacf831f.png

Feedback:  good that all hooks show whether they are in sitewide or not.   In my case queued email, qtpro and the holiday add on per @raiwa 

Testing shop parts that have non-sitewide hooks, they appear to still function.

So as for the basic shop hooks, the organization change here would be a plus for me. Instead of trawling through template top/bottom to update FA, BS, jquery etc it appears the particular changes would be done in the appropriate file in siteWide/. Meaning another step toward minimizing core file changing.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Testing on a Frozen(ish) site brought a potential problem, so files in .zip have been updated.

 


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Follow up on the test install.  The new info is displaying on the security checks at the bottom of the page.

Question for @burt

So if I'd update bootstrap, would I manually change the version in this line

class hook_shop_siteWide_bootStrap {
  var $version = '3.3.7';

in includes\hooks\shop\siteWide?

 

image.thumb.png.dfce71479c45393b810682fdde7e1652.png


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites
Posted (edited)

@altoid looking good, those versioning messages.  Hopefully they'll help to stop some of the griping about being able to work out what shopowners are using :) 

For changing/updating...here's an example

https://github.com/gburton/Responsive-osCommerce/commit/a063ce9a8dbc3f1bca4a1c334b230c320d630448

so, here I actually changed two things;

  • $version
  • the actual line of code that pulls in the script

Similar for jQuery.   Hope it makes sense.

I have worked on a bit more this morning and streamlined it further (for Edge), I haven't yet pushed/committed it as I want to test it a bit more first, but the general idea is that now an addon maker can just upload a new hook, and it is automatically injected into either the template_top / template_bottom (or both!) file. 

As an example;

Let's say that a developer made a addon that needed some jquery injected (which could be a content_module or a HT module), say adding a "SALE" sticker on each "special" in the product listings.  Instead of making a whole module...just make a simple hook and upload....

DONE (ie, no need to call the new hook in template_top/template_bottom!  As shown:

hookSpecial.jpg.2477b066bd9b8ce2e32029b25d304124.jpg

 

Edited by burt

This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites
18 hours ago, burt said:

Hopefully they'll help to stop some of the griping about being able to work out what shopowners are using :)

I very much doubt this as it does nothing to let the ordinary user know if he or she is using gold, edge, or frozen. Also very complicated way of doing somthing as simple as letting people know what they have just installed. All this can be done by having a simple file in the install zip which holds all the info and displays it in admin. Simple file which any user can edit and keep updated if they ever make changes.

For those that  download frozen with BS4 from the test site they will have this (see below) in version checker. So will know eactly what they have just installed, but then maybe I'm taking a too simplistic view of this!

image.png.a496ae6ebb8daf1422c29c1a3dd75ba2.png


 

Share this post


Link to post
Share on other sites

OK, thanks for the feedback.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×