I am having a category name 'package', and a few sub-categories attached to it, in each sub categories, I a having several products
Package
--SubCat1
----product1
----product2
--SubCat2
----product1
----product2
etc
I want to display in a comboBox the sub-categories, and according from the choice of the subcategory its products
How can I get all the sub categories from the parent ( package)
How to get the products from the sub categories selected ?
Thanks all
This is a good question, and ususally I do not answer with just a plugin raccomandation, but in this case - it will be too elaborated and long to to reply here ..
so - I have been using a great little plugin that does just what you need , and with a little tweaking, you will get the wanted result .
Also, you could have a look inside it´s rather simple code and see exactly how it is done ...
Plugin Name : Category Ajax Chain Select
Related
I just launched my first WordPress site, and I'm confused by WordPress' Categories feature. I would like to set it up so that I have three URL structures:
Regular posts display # mysite.com/post-title
Posts in the category "World" display at mysite.com/world/post-title
Posts in the category "Issues" display at mysite.com/issues/post-title
It looks insanely simple, yet it isn't working for me. I went into Dashboard > Settings > Permalinks and entered "world" where it says Category base. I don't know how to add "Issues," because you can apparently only add one category here.
Then I went into Posts > Categories and created two categories - World and Issues. I then created a new post and assigned it to the category World. (I also entered a lower case slug version.) But the post displays at mysite.com/post-title, not mysite.com/world/post-title.
In summary, I would like to be able to 1) create a category (e.g. World), 2) create a new post and assign it to that category, and 3) see that category represented in the URL structure (e.g. mysite.com/world/post-title).
Can anyone tell me what I'm doing wrong?
I have a Wordpress site where a lot of the categories are peoples names. The slug becomes john-smith fred-wilkinson etc by default. So the category list is in alphabetical order by their first name. I would like them to list by last name.
I could get the authors/editors to change the slug to wilkinson-fred etc but I would rather have a solution that they don't have to alter the default slug.
I know there are plug-ins that you can drag and drop to any order you want. Again this relies on the author/editor putting it in the right place.
My slugs currently look like this
john-smith
fred-wilkinson
Alan-t-jones
etc
I have other categories that I don't want to alter. I only want to reorder where the parent category is "artist".
Any ideas? If I put wilkinson-fred in the description field can I sort on that?
Thanks
I assume that you want to change the order of wp list categories function output (maybe make it a little clearer in your future SO questions!). If that's so, I think you have two options here:
1) Hijack the orderby parameter as mentioned in this answer by #Chris_O at Wordpress Stackexchange:
There is an unused column, term_order, in the wp_term_relationships table that you can use to assign a custom order to the terms within your taxonomy. The order is set at 0 by default and it will take a custom query to get the order back and another solution to set the order.
Although as #Kaiser mentions in the comments to the answer, this sollution is a little hacky as it's not meant to be used this way and its implemantation may change in future releases of Wordpress.
2) Store the output of the function in varible (echo => false under $args), manipulate the output and print the resulting array. This is the way I would choose as it makes you more in control of the situation.
I've been searching for hours, either for a plugin or some safe looking SQL to do this, but nothing seems to be exactly what I need...
I have a Wordpress site of approximately 32,000 posts, and we use various tags to help with administration on the back end (i.e. they're not visible on the front end or used for SEO, before anybody comments on too much usage of the same tag). About 30,000 of these posts include the tag 'new', but we need to now tag the remaining ~2,000 to match.
The WP administration panel isn't really up for the task - it would take somebody days to go through and apply a tag to 2,000 posts. Various plugins seem to exist but they don't really do what they claim in the descriptions. And the only SQL I could find that seemed helpful assumes that the tag is new and that I want to apply it to all posts in a single category. I suppose I could delete the existing tag (again, not a fun task with Wordpress' admin panel - it generally crashes after about 30 posts meaning somebody has to sit clicking the button over and over) and then run the SQL to apply a new.
Can somebody point me in the right direction please?
You could run a loop over all of your posts and use wp_set_object_terms() to add the desired tag:
http://codex.wordpress.org/Function_Reference/wp_set_object_terms
I had this problem today too. I tagged all of my posts with the following SQL. (Replace <prefix> with your DB prefix and "GlobalTag" with whatever you want your tag name to be.)
# create a term which will be your new tag
INSERT INTO <prefix>_terms (name, slug) VALUES ("GlobalTag", "global-tag")
# this is what defines the term as a Tag vs Category vs Video Category, etc
# only do this if you are creating the category through SQL, not the GUI
INSERT INTO <prefix>_term_taxonomy (term_id, taxonomy, count)
SELECT
(SELECT term_id from <prefix>_terms AS term WHERE term.name="GlobalTag") as "term_id",
"tag" as "taxonomy",
(SELECT COUNT(*) FROM <prefix>_posts AS posts WHERE (posts.post_status IN ("publish", "draft")) AND LENGTH(post_content) > 25) as "count"
# now tag every post with GlobalTag
INSERT INTO <prefix>_term_relationships
SELECT
id as "object_id",
(
SELECT term_taxonomy_id
FROM <prefix>_term_taxonomy AS term_tax
INNER JOIN <prefix>_terms ON <prefix>_terms.term_id = term_tax.term_id
WHERE <prefix>_terms.name="GlobalTag"
) as "term_taxonomy_id",
0 as "term_order"
FROM <prefix>_posts AS posts
WHERE (posts.post_status IN ("publish", "draft")) AND LENGTH(post_content) > 25
NOTE: you may want to tweak the posts query in here. This tags all posts that are published and/or drafts and that have content that is longer than 15 words.
Please help me determine the correct code for my drop-down search form. I want to be able to populate from a drop down: Categories – Sub Categories - Sub Sub Categories – Sub Sub Sub Categories. Here is how the form is displaying: Select a state – Select a County – Select a City – Select a Zip Code.
Also, When I select the first category It immediately display results; is there a way to stop the results from displaying after selecting but only populate the next sub category, and add a submit button to the bottom of the form that will display results?
I’m a newbie and I don’t mind paying a fee for your time. Thanks a lot for your help,
John
This is a very complicated task:
You need to identify a data source, such as this one, for a list of states, counties, cities and zipcodes in the U.S. provided in XML/JSON format.
You need to create a jQuery script that shows the right select dropdown depending on the prior section (using the data feeds above).
It's impossible to show an example here, because it depends on the language that you want to use, data sources, etc. If you don't have these expertise, you can post the job on any number of job sites.
I hope this helps.
Briefly: I'm making a custom view, I want a field listing the two taxonomy terms associated with an NID to output as two distinct links which return arguments for the view (term1 to view/term1, term2 to view/term2. Rather, it outputs as one aggregated link (both term1 and term2 output view/term1%0Aterm2.
Am I doing something wrong or is this not possible?
Exhaustively:
I am constructing a view of products (with the page output at http://example.com/products) in an drupal ubercart site because the built-in ubercart catalog psuedo-view isn't doing it for me. Some of these products belong to more than one taxonomy term (within the same vocabulary) - for instance, product_example1 belongs to terms blue and glowinthedark, product_example2 red and glowinthedark, product-example3 just blue.
I've created an argument which limits the view based on terms like so: products/red, products/glowinthedark etc returns this nice view I made but only with products which are associated with taxonomy terms red, glowinthedark, etc - so works as it should. Views is awesome!
Now, I want each product shown in this view to link to the generated product/[term] page(s). Outputting the field "taxonomy:all terms" as a link with replacement argument products/[tid] works for one term (product_example3's field works for its one term: /products/blue (views is awesome!) , but, AND HERE'S THE PROBLEM, it DOESN'T FOR TWO TERMS (or I assume more than two terms). This is true whether the field is output as a list or using a simple seperator. So, for product_example one, the field lists both terms blue and glowinthedark (correctly separated as list items or with the chosen "," simple separator), but both terms output the relative link products/blue%0Aglowinthedark.
Is that clear? I haven't been able to google anyone with a similar situation, strangely, although I can't imagine I'm the first to run into this. I may just give up since it's not all that important and I can think of several less-satisfactory but still doable workarounds, but I thought you all might have some insight. The only thing that gives me hope is that when the "Link this field to its term page" check box is selected, views successfully outputs two separate line items with links to the two separate terms' pages.
I'm also posting this question on Drupal.org. Thanks for your time!
Hmmm... strange. I read your question carefully. However I am getting the results that you desire!
I have a taxonomy vocabulary that is multiple select (lets call it "Sector")
I have a taxonomy vocabulary that is single select (lets call it "Location")
In my fields section, I add Taxonomy: All Terms
In the settings for Taxonomy: All Terms I select "Output this field as a link". In there, I set the "Link Path" to product/[tid]
I make sure "Link this field to its term page" is NOT checked
I use a simple comma separator
"Limit terms to a specific vocabulary" checkbox does not matter. It would depend on your business requirements.
As required by you I get products/abc, products/xyz etc. one after another on a single line. This works even if a particular node has multiple terms from the same taxonomy vocabulary. I don't get any %0A stuff.
This works out of the box for me. I tried with both views 2.11 and views 3.0-alpha3
Try upgrading to the latest version of views and see if you have better luck?