Jump to content

Recommended Posts

This addon is a replacement for the previous MATC module. It is fully compatible with all community edition versions of oscommerce but it does require raiwa's modular checkout pages addon to be installed..

Once installed, it will place a check box on the create account, checkout payment or checkout confirmation pages, depending  upon the settings in the module. The check box prevents the customer from proceeding unless they check that box.

If the check box is to appear on the create account page, a few file edits are requited. Otherwise, it all works with the installation of modules.

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

Dear jack @Jack_mcs

Is this addon only compatible with the Frozen version?

Best regards.

Valqui


Please do not falsify my words. Are you interested in knowing who does it? Send me a PM.

The Phoenix Club won't allow me to join - why not?

Setting up a new Frozen site with so many nice addons available on the market. 

:heart: Community Oscommerce fan :heart:

 

Share this post


Link to post
Share on other sites

It is compatible with any of the CE versions but it does require raiwa's modular checkout addon to be installed. Also, if a shop has the old MATC installed, it has to be uninstalled. I apologize for not clarifying those points. I have changed the text in my posting above to mention the required addon.

Share this post


Link to post
Share on other sites

I set the MATC to checkout_confirmation. It works fine it seems but I get the following error warnings when calling up checkout_confirmation.php (PHP 7.1):

PHP Warning:  Illegal string offset 'type' in .../includes/functions/html_output.php on line 350
PHP Warning:  Illegal string offset 'type' in .../includes/functions/html_output.php on line 353
PHP Warning:  Illegal string offset 'type' in .../includes/functions/html_output.php on line 354
PHP Warning:  Illegal string offset 'type' in .../includes/functions/html_output.php on line 357
PHP Warning:  Illegal string offset 'type' in .../includes/functions/html_output.php on line 367
PHP Warning:  Illegal string offset 'type' in .../includes/functions/html_output.php on line 375
PHP Warning:  Illegal string offset 'type' in .../includes/functions/html_output.php on line 394

 

Share this post


Link to post
Share on other sites

I don't have this installed in a shop running 7.0 so I can't say for sure but it is most likely due to passing the ID for the button. In 7.0, strict mode is set by default and it reports things like this. In this case, and probably in all cases, they are harmless and can be ignored. I may look at this at some point but I suggest changing the error_reporting line near the top of includes/application_top.php to the following:

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_DEPRECATED);

 

Share this post


Link to post
Share on other sites

 Unfortunately I don't really understand what the code does but I can confirm that the error seems to be related to the 5th parameter of tep_draw_button which is   'id="TheSubmitButton"'

When I change

tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fa fa-angle-right', null, 'primary', 'id="TheSubmitButton"', 'btn-success');

to

tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fa fa-angle-right', null, 'primary', null, 'btn-success');

it does not produce the error, and still seems to work (I don't have the popup or textarea option enabled, is the parameter needed for some javascript for these??) ... but as said I don't really understand what I am doing there so probably not a good idea?!

Also I found that 'id="TheSubmitButton"' does not appear in any core files, neither in the addon except within the tep_draw_button. Shouldn't it be defined somewhere?

 

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_DEPRECATED);

This did not change anything (the error is in the error log, not onscreen)

 

Share this post


Link to post
Share on other sites

First, to be clear, it is a warning, not an error. There is a big difference been the two. When the strict mode is enabled in php, it checks that a variable is declared before using it. So there can't be code like

$var['this'] = 'a';

It has to be

$var = array('this');
$var['this'] = 'a';

It is a way for the php interpreter to check for possible problems. It can be very useful when developing a piece of code but not when the code is running.  In this case, the ID being passed has not been declared as required for that function but the code in the function doesn't care about that and it works fine. So while it should be fixed as a technical issue, as a practical one it is not worth the bother.

The line I gave you to disable strict mode won't work on all servers. You would need to ask your host to recompile php with strict mode disabled. 

 

Share this post


Link to post
Share on other sites

I found a problem with the MATC module on the create_account page.

When the customer enters data incorrectly so that the Continue button does not lead to the success page but reloads the page with an error warning , the MATC module bevaves weird.
(I am talking about the case when there is a warning box on top of the page, small or first (?) errors like too short entries sometimes just open a pop-up hint, no problem in this case)

The problem: all entered data is still there and the matc checkbox is still checked (which is alright) BUT the Continue button is hidden. The button will be shown when you UNCHECK the checkbox now!! A click on the button will reload the page with the error note that you must check the checkbox! At least then the checkbox is again unchecked, when you check it the button appears and this time the account will be succesfully created.

Apparently, the customer's data and the state of the check box were recovered when reloading the create_account page after the first error but the button is hidden by the code on top of matc.php nevertheless. So the button state (show/hide) does not match the state (checked/unchecked) of the checkbox.

I found a solution for me but it is probably not the ideal one. Maybe anyone better in coding can sort out how to fix it properly (maybe to set 'checked' always to false whenever the page is loaded)

(My solution was to show the button always, by removing the script on top of matc.php.  I am fine with this as it is the way it is on many websites. I had to paste in the script in the template of the buy button on checkout_confirmation instead as otherwise you could buy there without checking the MATC checkbox)

Share this post


Link to post
Share on other sites

I just tried creating an account here but made a mistake on the form, like not entering the city, and when the page reloaded the checkbox was checked and the button was present. In your situation, does it matter which browser you are using? What php version are you using?

Share this post


Link to post
Share on other sites

I used Firefox, PHP 7.1

I made some little cosmetic changes to some files, like replacing the text next to the box with one with two html links (to conditions and to privacy_policy), and I set the check box left of the text instead of right.

But I also tried with the original, unmodified files (I hope all...) to make sure that the problem was not related to my changes, and it was still there. Maybe I missed something?

Will check again tomorrow.

 

Share this post


Link to post
Share on other sites

I checked again and this time I made 100% sure I have only original files. The problem is still there!
(Tested with Firefox and Microsoft Edge)

21 hours ago, Jack_mcs said:

...like not entering the city, and when the page reloaded the checkbox was checked and the button was present.

I guess you missed it because of this: There seem to be (at least) two different 'error levels'. With just a 'minor' mistake the page 'reloads' like in the screenshot, with a popup note. No problem in this case, the MATC behaves correctly:

image.png.f97614a9cdb719e20865ed332d95e85d.png

Sometimes however the page reloads with a WARNING ON TOP (like password errors? or multiple errors? repeated errors? not sure why and when this is in contrast to the first error type):

image.png.cb285064db6ab4e655f9bd9e2184290e.png

In this case the MATC button seems to be 'offset' with the checkbox (which is checked but no button):

image.png.6869b99dcc53a6935a27f8c2e3651c1a.png

Unchecking will show the button now, 'Continue' will result in a MATC error: "you need to agree with the T & Cs.."

 

Share this post


Link to post
Share on other sites

Thank you for testing it. You are correct. The code doesn't work correctly when a non-javascript error occurs. Please try this change to see if it fixes it. Find

  <div class="buttonSet matc-button-wrapper">
    <?php echo '<div class="text-right">' . tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fa fa-user', null, 'primary', 'id="TheSubmitButton"', 'btn-success'); ?></div>
  </div>  

and place this below it

  <?php if ($error) { echo '<script type="text/javascript">$(function() { $(".matc-button-wrapper").show(); }); </script>'; } ?>   

 

Share this post


Link to post
Share on other sites

@Jack_mcs

Getting the same on screen warnings on checkout confirmation as another user posted above

PHP Warning:  Illegal string offset 'type' in .../includes/functions/html_output.php on line 350 etc.

Changing application top does nothing and servers are unhelpful.

Please do you know if you are posting update to this addon to fix this as we are keen to use it.

Share this post


Link to post
Share on other sites
5 hours ago, Heatherbell said:

PHP Warning:  Illegal string offset 'type' in .../includes/functions/html_output.php on line 350 etc.

This is caused by the code in the core file, the tep_draw_button function specifically. Here is a fix for this addon but the warnings will appear for any addon that uses the params parameter in the use of that function.

In the includes/modules/content/checkout_payment/templates/tpl_cm_cp_continue_button_matc.php, change

?>
<div class="col-sm-<?php echo $content_width; ?> cm-cp-continue-button-matc">

  <div class="buttonSet matc-button-wrapper">
    <?php echo '<div class="text-' . MODULE_CONTENT_CHECKOUT_PAYMENT_CONTINUE_BUTTON_MATC_ALIGNMENT . '">' . tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fa fa-angle-right', null, 'primary', 'id="TheSubmitButton"', 'btn-success'); ?></div>

to

$params = array();
$params['newwindow'] = '';
$params['params'] = 'id="TheSubmitButton"';
$params['type'] = '';
?>
<div class="col-sm-<?php echo $content_width; ?> cm-cp-continue-button-matc">

  <div class="buttonSet matc-button-wrapper">
    <?php echo '<div class="text-' . MODULE_CONTENT_CHECKOUT_PAYMENT_CONTINUE_BUTTON_MATC_ALIGNMENT . '">' . tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fa fa-angle-right', null, 'primary', $params, 'btn-success'); ?></div>

The above is for the MATC button on the payment page. If you use a different page, that code will have to be changed too.

Share this post


Link to post
Share on other sites
On ‎4‎/‎2‎/‎2019 at 1:51 PM, Heatherbell said:

Uncaught TypeError: Cannot set property 'onclick' of null

How do I duplicate that error?

Share this post


Link to post
Share on other sites

@Jack_mcs

Sorry I don't know what I'm doing, just a shop owner. Only just converted our shop to Frozen from Gold and still trying to get it to work like we had the Gold shop working.

I was using Chrome to check my page https://cornishhoney.co.uk/checkout_confirmation.php (right click on page and click inspect and code screen opens on right - somebody showed me this - don't know what it is!) and see a white cross in a red circle in the code screen indicating 1 error which I guess might be a bad thing but as I said, the answer you gave in previous post made the MATC work. The error says: Uncaught TypeError: Cannot set property 'onclick' of null  at checkout_confirmation.php:359(anonymous) @ checkout_confirmation.php:359

We also had your Article Manager working on our old Gold site but can't get it going on Frozen - I've made a load of extra information pages to replace it but would prefer Articles.

Thanks so much for taking the time to even read this.

Share this post


Link to post
Share on other sites

@HeatherbellNo need to apologize. :)  What you provided was enough for me to see the problem. To fix it, find this in the includes/modules/matc.php file

var modal = document.getElementById('matc-modal');

and add this above it

var isModal = '<?php echo (MATC_SHOW_POPUP == 'True' ? 1 : 0); ?>';

if (isModal == 1) {

Then a little lower in the file, find

</script>

and add this above it

}

I tested the above under 7.1 and it worked without error. There is a known problem with using the popup and not the text area option. That has been fixed in the next version.  This doesn't have anything to do with this problem but I thought I would mention it in case you found that next. :)

Regarding Article Manager, it has not been updated in almost three years so it won't work for newer php and CE versions. A new version is close to being released but it still might be a month or more before I can get to it. :(

Share this post


Link to post
Share on other sites

Just did that and the scary white cross in a red circle error disappeared - yay!

Glad to hear that Articles Manager will be reborn.

Thank you so much for your time and help (and kind patience) - your hard work and ever friendly advice helps keep our family business going which is a big deal to us.

Share this post


Link to post
Share on other sites

Just noticed that the checkbox has an id="TermsAgree" in parameters so found a solution that works but I am not a coder so maybe not the best one:

In includes/modules/matc.php

near bottom of page before closing </style>

add:   #TermsAgree {height: 30px; width:30px}

Share this post


Link to post
Share on other sites
6 hours ago, Heatherbell said:

Just noticed that the checkbox has an id="TermsAgree" in parameters so found a solution that works but I am not a coder so maybe not the best one:

Good job. :) 

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

×