Jump to content

Recommended Posts

This addon provides a quick way to display messages in the header of a Bootstrap shop. It is a vert simple installation.

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

Hi Jack, testing this out.  php version 5.6 Got this notice:

Notice: Use of undefined constant TEXT_MESSAGE_PLACEHOLDER - assumed 'TEXT_MESSAGE_PLACEHOLDER' in ......


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

I'm not seeing that here but it is probably due to the strict error setting in that php version. But, regardless, the code causing the problem should not even be there. Please edit the includes/modules/content/header/cm_header_messagebox.php file and remove the following. Please let me know if there are any other problems and, if not, I will get a revised version uploaded.

      $message_box = '<div class="messagebox-margin">';
      $message_box .= tep_draw_form('quick_find', tep_href_link('advanced_message_result.php', '', $request_type, false), 'get', 'class="form-horizontal"');
      $message_box .= '  <div class="input-group">' .
                          tep_draw_input_field('keywords', '', 'required placeholder="' . TEXT_MESSAGE_PLACEHOLDER . '"', 'message') . '<span class="input-group-btn"><button type="submit" class="btn btn-info"><i class="fa fa-message"></i></button></span>' .
                      '  </div>';
      $message_box .=  tep_hide_session_id() . '</form>';
      $message_box .= '</div>';

Share this post


Link to post
Share on other sites

@@Jack_mcs After modifying as above, that notice does not appear now.  This is in a uniserver test shop, with the php as above and error reporting as follows:

 

// set the level of error reporting
//  error_reporting(E_ALL & ~E_NOTICE);
error_reporting(E_ALL);

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

Are you just letting me know the error has gone or is there still a problem?

Share this post


Link to post
Share on other sites

Are you just letting me know the error has gone or is there still a problem?

Errors gone, I was just showing the error checking setting in case you wanted to try something else to test it.


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

Oh, I see. Thanks. The problem is that the php developers changed what error_reporting shows in the latest versions of php. I don't develop using those versions so unless I enable strict reporting, such errors won't show up. It's usually not a problem but silly mistakes like the one I made here will trigger it.

Share this post


Link to post
Share on other sites

@@Jack_mcs, I have this addon on a live site, works ok and very useful, thanks.

however , I've just noticed that on mobile devices the message box appears slightly to the right of it's location, see attached image.

 

Can you advise? running 2.34.BS gold

 

Thanks

Mike

post-328457-0-32462000-1467283052_thumb.jpg


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

@@Mikepo In the user.css file, find this code

.message-box {margin-top:14px; margin-left:40px; padding:5px 4px; border:1px solid red; 
background:#FEE60A;
-moz-box-shadow: 0 0 5px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 0 5px rgba(0,0,0,0.5);
box-shadow: 0 0 15px rgba(0,0,0,0.5);}
 

And add this below it

@[member=media] (max-width: 640px) {
.message-box {margin-left:0px}
 } 

Share this post


Link to post
Share on other sites

A new version has been uploaded with these changes:

 

  • Added a second message option.
  • Added code to rotate the messages.
  • Changed css to better display with mobile devices - found by member Mikepo.
  • Removed unnecessary code.

Share this post


Link to post
Share on other sites

Thank you Jack!

Although mine is not working the way you intended, it is perfect for my purpose.

Just FYI, in your original version, I had a few lines of HTML followed by a line of plain text.

In the latest version I put the HTML in box one & plain text in box two. It would fade and message two never showed, fade back to one.

I put my whole original string in box one and other plain text in box two. Box one HTML fades, plain text stays, message two never shows. Leave box two empty and it doesn't fade.

I'm happy with the results of the blue line configuration with long show, quick fade out-in as it brings attention to the important part. 

Share this post


Link to post
Share on other sites

I setup my test shop here to have the messages as you describe and it works as expected. Please make sure the first delay setting is at least twice the fade delay setting, as mentioned in the settings. If not, it will cause problems like that.

Share this post


Link to post
Share on other sites

@@Jack_mcs @@Big Bear

I noticed the same scenario, when I used £

the text (html) in the second box wouldn't appear,

so instead of £ I used £, now everything works as it should.

Hope this helps

Mike


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

@@Jack_mcs

Hi Jack

 

Great addon. Just one thing how do you change the height of the box, Im thinking so as the box is say 40px high.

 

Many thanks

 

Grandpa

Share this post


Link to post
Share on other sites

In the user.css file, change the .message-box class to include height:XXpx; where XX is the height. Note that there are two instances of that class, one for desktop and one for mobile. You need to change them both to what works in each case.

Share this post


Link to post
Share on other sites

Just FYI, in your original version, I had a few lines of HTML followed by a line of plain text.

In the latest version I put the HTML in box one & plain text in box two. It would fade and message two never showed, fade back to one.

I put my whole original string in box one and other plain text in box two. Box one HTML fades, plain text stays, message two never shows. Leave box two empty and it doesn't fade.

I ran across this in a new installation. The problem was that the previous messages used a closed br ( <br /> ) and the / was preventing the code from working as it should. Change that to <br> allowed it to work. I haven't looked at why that fails but if you, anyone, has this problem, try removing the / to see if it helps.

Share this post


Link to post
Share on other sites

This addon provides a quick way to display messages in the header of a Bootstrap shop. It is a vert simple installation.

Jack;

I have installed the latest version of the message box (01/04/2017) and I love it, but the second box feature does not work.

If I set up the second box, I get the first box over and over.

I use just one box (first or second) and it works fine

Share this post


Link to post
Share on other sites

@@stevenlemon Did you make sure about the time settings and use closing slashes? Both are mentioned above. If you are not sure, change both messages to plain text and see if that works. Then, assuming it does, add some of the changes back in until it fails to find the problem.

Share this post


Link to post
Share on other sites

A new version has been uploaded with these changes:

  • Added code to automatically handle all languages so it is now possible to have a different message for each language.
  • Added code to allow messages to be loaded from the Information Pages SEO addon Just use INP_X, where X is the message ID.
  • Added an entry for the message text class so the font color can be changed.
  • Added an entry for the message text class so the font background color can be changed.
  • Added an option to allow the messages to be displayed in a box, as before, or in a circle.
  • Changed the code to use a textarea for the messages.
  • Changed the code to make it compatible with Phoenix.
  • Moved the css to the template file.

 

Share this post


Link to post
Share on other sites

This is really useful as I can use it to display festive messages with nice pictures now. In our multi-racial home country, there are simply many occasions we need to greet the customers.  Thanks, Jack!

Share this post


Link to post
Share on other sites

I believe I applied your changes properly, but when I attempt to do the "install", there is no "messagebox" in the functions list.  What did I miss?

--N

Share this post


Link to post
Share on other sites

@Jack_mcs

On 7/7/2019 at 11:22 AM, Jack_mcs said:

A new version has been uploaded with these changes:

  • Added code to automatically handle all languages so it is now possible to have a different message for each language.
  • Added code to allow messages to be loaded from the Information Pages SEO addon Just use INP_X, where X is the message ID.
  • Added an entry for the message text class so the font color can be changed.
  • Added an entry for the message text class so the font background color can be changed.
  • Added an option to allow the messages to be displayed in a box, as before, or in a circle.
  • Changed the code to use a textarea for the messages.
  • Changed the code to make it compatible with Phoenix.
  • Moved the css to the template file.

 

Thank you for your support of the Phoenix project!

M


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

×