Show Posts


Messages - dhigz

Pages: 1 [2] 3
16
Extensions and Add-Ons / Best place to hook for a completed order?
« on: July 16, 2020, 08:22:27 PM »
Hi,

What is the best controller and method to hook to in order to capture a successfully completed order with payment made. Is ControllerPagesCheckoutSuccess the best controller? Or do you recommend another controller/method?

I do see the value for $this->session->data['processed_order_id'] is created after validation. Are there any other indicators of a successful order?

Thanks.

17
Thanks Basara,

I pretty much came up with the same solution of changing the
value = tinyMCE.activeEditor.getContent();
to
value = tinymce.get('text_editor_<?php echo $id ?>').getContent()

I also changed it in the else statement
} else {
            $('#'+newtab_id+ ' textarea')
                  .val(textarea.val())
                  .removeAttr('disabled');
            if(tinyMCE.activeEditor != null) {
               value = textarea.val();
               value = html2visual(value);
               tinyMCE.activeEditor.setContent( value );
            }

Thanks for making the change.

18
There is an inherent problem in AbanteCart with having more than one tinymce editor loaded on a single page. I have an extension where I need to have multiple instances of tinymce loaded. There may be other developers with the same issue.

In the admin/view/template/form/text_editor.tpl file which loads the instance tinymce for each texteditor form field type, the first command in the javascript portion is to remove all existing instances of tinymce on the page. This is correct in the creation of the custom tinymce editor used in AbanteCart. However, when the second instance is added it also removes the first, third removes the first and second, etc. While the editor looks and works right for the HTML/Text portion, the Visual portion will only work on the last instance added.

The solution is to remove the specific instance being loaded. Instead of tinymce.remove(), replace with tinymce.remove('textarea#text_editor_<?php echo $id ?>').

Now all instances of tinymce will work correctly. Please make this change in the next release.

19
Got it to work with suggestion #2. Thanks again for your help.

20
I am working on an extension that uses the new "Quick View" option. Everything is working great but I need to filter out a description field in quick view mode. The problem is I cannot get the viewport_mode value in func_get_args() in my hook function. The hook function does process  func_get_args() and I can get other value pairs, just not the viewport_mode/value pair.

I tried calling func_get_args() an InitData hook for the page, but get same result (or lack there of). Same result if called in an UpdateData hook.

The only way I could get it to work is to add $this->data['viewport_mode'] = $viewport_mode; to the base file.

Do you have any suggestions on what I can do so I do not have to edit the base file?

Thanks

21
Extensions and Add-Ons / Re: How to get and return data to Listing_Grid Hook
« on: September 09, 2016, 06:55:09 PM »


Wow, that worked great. Didn't even think about using CommonListingGrid. I'm going to use this for some other added features.


Thanks for your help Dimitri.

22
Extensions and Add-Ons / How to get and return data to Listing_Grid Hook
« on: September 08, 2016, 07:37:09 PM »
Hi,

What I am trying to is to add an additional drop down to the product search/filer form on the catalog/products page. No problem adding the field to the form through a hook. The problem is getting and returning data to the listing_grid controller with any form of hook (on, before, etc. & InitData, ProcessData, etc.)

With a standard controller, you can get data from the controller with $that->view->getData when the controller data is in the form of $this->data, $this->post, etc.. You can transfer data from the hook to the controller with $that->view->assign or $that->view->batchAssign($this->data). You can even resort to sessions.

Keeping in mind that we do not want to unnecessarily edit the base controller file, how do you transfer data back and forth with a listing_grid controller? Specifically how would I get filter data in and/or the response back? I could not find anything in the Developer guide that helps.

What have I tried?
1 - With the original goal I tried to add the new field value to the filter value with onControllerResponsesListingGridProduct_InitData and onControllerResponsesListingGridProduct_UpdateData. This is useless as anything you submit is overwritten in the function.

2 - Rewrote the entire ControllerResponsesListingGridProduct under onControllerResponsesListingGridProduct_UpdateData starting off by setting the original response to an empty array. The final command of the hook function is to set the output. I also created another query with parameters added for my filter data and call this query in the hook function.

Now what happens is both run, first the original then the hook. Tried using InitData, same result just the hook runs first then the base function. No matter which option, the output is still the result of the base controller function.

3 - Tried  aroundControllerResponsesListingGridProduct_InitData. Around does not work.

The only way I got it to work is commenting out  $this->load->library('json'); and $this->response->setOutput(AJson::encode($response)); in the base controller. Exactly what I want to avoid.


Any suggestions, ideas?




23

There is a small formatting issue on order confirm mail template (template/mail/order_confirm.tpl). It has existed on the first version I downloaded (1.1.9) and still exists today.

While it does not detract in any way to this wonderful shipping cart application, it is visible to every one of our customers. I fix it every time I upgrade, so I thought it worth mentioning and maybe it can get fixed.

If you look at the order confirmation email the customer gets, the top of the Model column does not align with the rest of the row. This is because it does not have the same style settings as the rest of the rows. Simple fix: add width: 15%; padding: 0.3em; to the style attribute to match the other columns.

Good to go.

Don

24
Dmitriy,

Do you need to identify the method when there is only one method in the class? I didn't try it as I mentioned I did find a work around.

Bottom line, the around_ method does not seem to work.

Thanks for your help.

Don

25
Actually while I would like a solution to one of my two problems, I did find a way around the issue. It's just talking more coding.

26
Ah... yes, of course.

I just didn't use it in my example.

27
No matter what I do I cannot get the aroundClassNameMethodName_InitData function to work in my hooks file. Everything else (on, before, etc.) works fine.

What I am attempting to do is to replace the main function on storefront/pages/checkout/confirm.php with my own function and stop the native function from running. Using around will not allow my function to run but the native function still does. Using any other extension hook for InitData, my function will run but will still allow the native function to run. I can't use update data because the "damage is already done". In other words the order gets saved, exactly what I am trying to stop.

What I really want to do is is stop the existing "save order" function call in and replace it with a "save order" function of my own. I have specific requirements that do not work with the existing order core file.

I have tried replacing the entire confirm.php file with my own by placing my version in my extensions storefront/pages/checkout directory and adding the path in my extensions main.php file, but apparently this does not work as the controller will not be overridden. (interesting result though, when you remove the native controller file, it does use the extension controller file).

So I have two possible solutions and neither work. 1) use the extension hook "around" or 2) get the extension controller file to override the native file.

Any thought, ideas?

Don

28
I am using the hook onXxxxx_UpdateData in my extension core file to add a form field to an existing form. I don't want to just put it at the end but rather in a logical place within the form.

Is there a way to insert a form field after an existing form field? Any trick hidden functions I can use?

Open to suggestions.

Don

29
General Discussion / Have you ever output a $form array?
« on: August 02, 2016, 01:40:40 AM »
Have you ever output a form array? (print_r(array_values($form))) I did. It's huge as every element has the entire registry in the array.

If you want to try it, be careful as it will eat up your memory. Make a form with one form element just to see.

So AbanteCart gurus, can you tell me why every form element includes the entire registry as one of it's array values? There must be some valid reason to have all of this overhead every time you output a form.

Don

30
General Extensions / Re: Multiple instances of timymce on admin pages
« on: July 27, 2016, 12:28:22 AM »
I found a solution that works for me.

First off, the updateable field error turned out to be unrelated and caused by another problem. One down.

Also found that adding media did not work correctly either. You click "Add Media" on the first instance then choose an image, it gets added to the second instance. Upon deeper investigation, I found that the first tinymce instance was never even created (no containers).

There were two root causes of the problems:
The first cause is due to the fact that the tinyMCE.activeEditor value does not get the value of the actual active editor. The id of the element needed to be defined in the jQuery script for each instance. After fixing this, I at least got the values to be correct when changing states between edit and visual, but the first tinymce instance was still not being created.

The other problem centered around the init method. As part of testing I created a new tinymce.init with just the selector value. Suddenly everything worked. Using a common array is good in theory but it does not appear to work with multiple instances.  What I ended up doing is copying the values in the mcei array in head.tpl to my new init statement.

Everything is now working correctly. I have attached my solution.

I also needed a method to turn off the "Add Media" button for a specific field. I accomplished this by assigning an attribute of no_media to the $form->getFieldHtml array and since I already edited the text_editor.tpl file, added some language to turn off the button. This is a quick fix, but might be something to add to later releases.

Don


Pages: 1 [2] 3

Powered by SMFPacks Social Login Mod