WooCommerce: How to disable variable_product_type_options in my plugin? - performance

I want to disable the call to variable_product_type_options in my plugin. The plugin is a little helper function, that will help the user to create custom variations, instead of going through the regular variations in the default form. I want to do this, because a product has very long loading and saving times when it has too many variations (say, for example 100). Also, nobody really wants to edit these manually. Anyway, they are loaded by default for a product of type "variable", so I want to remove this.
I know, all I have to do is this:
remove_action('woocommerce_product_write_panels', 'variable_product_type_options');
The only problem is, that I can't find the right place to do that. I have tried in the action "woocommerce_loaded" but it's still there. So I need to know which WooCommerce action will be fired after the woocommerce_product_write_panels but before the admin form for the product is processed.

Related

Comic navigation in joomla?

I have a joomla site and would like to integrate some old unfinished webcomics to it, so I can pick them up where I stopped in a CMS that won't leave me in an absolute frothing rage (thanks, wordpress).
I've got some experience with Joomla and I believe it would be a pretty good platform for managing multiple comics... except for the small issue of horrid navigation between pages/articles. Joomla's integrated article navigation is a humble but passable start, but if you intend to use categories to organize chapters then getting from the end of one to the beginning of the next is... yeah. This is a pity, as Joomla's category and article management options are beautiful for archiving and presentation, and adding gantry 5 to it means a great deal of control over the reading experience. Basically, joomla has pretty much everything I want, except for the navigation.
Ideally, what I'd like to be able to accomplish for comic navigation in joomla is:
Clickable full-article-image leading to next article/page
Prev/next article buttons (already available)
Prev/next category buttons (do we have those?)
The latter two in a module I can choose where to publish (optional)
And this is it, basically. I understand that implementing the first could be very hard without some major template customization, in which case I'd be willing to insert the image as a link in the article body... but only if there was one single code I could use, like the one that generates the next category article button. Because I'm not willing to create hundreds of menu items to generate links page-by-page.
So is any of this doable?
This is a quick answer but too much for a comment. I'm assuming since you are on SO that you don't mind coding (as opposed to just configuring).
I think you need to do two things. First you need to create a pagination.php for your template. This will let you really super control what the pagination looks like. You can have images, special css and js, whatever you want. You can also add the "last" and "first" options.
I think you need to make a new plugin to replace the core pagenavigation plugin and that also generates the previous/next category links. (Or I guess you could make one just to do categorynavigation depending on what you want.) HOWEVER, it seems to me that there is data on the sibling links that is already being generated in the content category model so you might be able to use that. (Check the code; I think there was never a UI for it, but it is there. Even if it isn't there, siblings are very easy to obtain in nested sets)
The other thing you can really think about if you go that route is changing the whole thing somewhat to use a module that gets the current ID and category ID from JInput. You might also be able to use JPagination. The important thing, however is that you make sure to do the caching the way the pagination that is there does it. In other words you really want to cache the whole list in the order you want so you are not running so many queries and slowing your site down. You may want to look at the categories and category modules to get some ideas about the queries to do.
Hope that gets you started, but it is definitely something you can do without too much trouble.

Joomla 3 Overwrite/Change "Menu Manager: Edit Menu Item"

Like the topic say I want to overwrite/change the "Menu Manager: Edit Menu item" layout. To illustrate my question:
In the picture whiche is shown I want to change the labels: Layout, Option, Integration.... and add some other options to it. How can I do it? Or is this even possible?
In order to change the text, simply use language overrides, google is your friend.
In order to add functionality, let's first of all explain what we're talking about to ensure we're on the same page.
Joomla components have views which can have one or more layouts, i.e.
/components/com_content/views/category/tmpl/ contains two layouts, blog and default.
A layout can additionally contain an .xml manifest (in our case, blog.xml and default.xml) allowing us to create a menu item for the specific view/layout combination. The .xml file contains the parameters that the user will set, you can add your own as well.
When you want to change Joomla, usually there is a way to do so without touching the core, which would be pretty bad, as any Joomla! updates would break your work.
For the view layouts a special feature called template override was developed, which allows you to create an alternative to the view layout in a safe place (under your template folder, in this case your admin template), and this is the most elegant and effective way to achieve your result.
Beware though, you are just creating a layout, most likely you will want to add functionality, if it's complex you might be better off creating a dedicated component to keep the code clean. Or you can just put all the logic in your view, query the database from there. But in this latter case, get paid, and run away. Never answer the phone to the customer again.
A final alternative is to write a system plugin that will manipulate the page markup after it was generated in the event onAfterRender(). This is a simple and good approach if you only want to add a button or make minor changes, but if you do anything more than that, see the above advise about running away.

Joomla : Which module is this part of?

I am working on Joomla 1.5 right now and was wondering if there is a way to figure out, from the UI, on which module this is part of ? Eg, there is a picture viewer on the home page and I want to know which module is triggering it.
I do it the hard way no, where I goto all modules and check if each had anything to do with it. But was wondering if there is an easier, faster way.
Thank you :)
In Joomla 1.5 you can simply add ?tp=1 to the url to force the system to show you the template positions. You should just about be able to make out the name of the position in question. From there go to the module manager and filter the list by position.
It shouldn't be too difficult to figure out - the module will have rotator, slideshow or similar in its name/type.
It is probably set to show on the home menu item only too.
In my experience, this is an issue with most CMS - Drupal, Wordpress, and Joomla included. And it can be very frustrating. My approach is normally:
Search the module listing for something likely. So, in your example, I'd search for 'picture', 'viewer' 'gallery', etc. and, hopefully, a likely-looking modue would turn up in the listing. Usually, viewing its settings screen makes it obvious whether that module is the relevant one or not.
If that fails, I usually look at the source (easiest with firebug), and identify something that is likely to be fairly unique - e.g. a class name or a specific attribute in the markup. Once I have that, I resort to find/grep on the command line to identify the origin.
If you find yourself with a lot of extensions, and this becomes a regular problem, you could think about modifying templates to include a comment that identifies their module.

Saving wysiwyg Editor content with Ajax

I am writing a cms (on .net) and have structured the whole page to work client side.
There is a treeview that lets you add/remove/move items and define their names in the languages defined. For each language I save the names of the category defined, but when there is HTML content associated with it, i fall into the JavaScript serializer problem that finds the content too long to be serialized.
What would be the best approach to make sth like this work. Shall I change everything to work with postbacks, or try to manually call _doPostBack for the editor content (which I don't want). Thank you in advance.
I guess would be great to make auto-save with time interval which will submit only diffs between current state and previous save. It will do the key if the user will edit it manually, not for copy/paste, of course. It is if we talk about really big data that we need to save.
Otherwise need to find some ways to compress the data before submitting: json+base64, etc.

Magento : create ajax dropdown populated with labels of 3 product's attributes.

Greetings,
I'm, unluckily in need of having this :
Product has (lets say) 6 attributes with "Yes/No" values.
I need a dropdown on that product's page that will populate with attributes with "yes" value.
attributes are :bundle1,bundle2....,bundle6.
When selection is made - I need to know whats have been selected to pass that to php on that page.
I have no idea what preexists in Magento (in terms of Ajax snippets) that could be used for this, searching for solution...
I used additional request.js and pulled attributes from a newly created table in DB (manually, for 1 product, just for test) and it works.
But, thats not idea, I dont want to do it manually everytime.
Syntax is killling me.
Thank you.
This may not be helpful at all... But I just recently created a module that taps into Magento's ajax autopopulate functionality. What this module does is does an autopopulate of all the manufacturers, depending on the string you are typing in. I know this isn't directly what you are wanting to do, but this may help you get started, at least with the ajax:
/app/etc/modules/Ash_Manufacturers.xml
http://pastie.org/841014
/app/code/local/Ash/Manufacturers/etc/config.xml
http://pastie.org/841017
/app/code/local/Ash/Manufacturers/controllers/IndexController.php
http://pastie.org/841018
/app/code/local/Ash/Manufacturers/Block/Manufacturers.php
http://pastie.org/841020
Look at rows 79-92 on this one:
/app/design/frontend/default/ash/template/catalog/layer/filter.phtml : http://pastie.org/841027

Resources