categories

Recursive function for category and sub-category

蹲街弑〆低调 提交于 2019-12-06 12:19:00
I need help regarding recursive function We have a category table contains category_id,category_name and parent_id: category_id category_name parent_id ------------+--------------+---------- 1 Agriculture 0 2 Appearl & Fashion 0 3 Chemicalas 0 4 Plastic & Plastic Products 0 5 Automobile 0 14 Coconut Shell Products 1 15 Nuts & Kernels 1 16 Plant & Animal Oil 1 17 Potpourri 1 18 Raw Cotton & Cotton Waste 1 19 Rice 1 20 Tea 1 21 Seeds 1 22 Vegetable 1 23 White Rice 19 24 Green Rice 19 25 Basmati Rice 19 26 Boiled Rice 19 27 Fresh Preserved Vegetables 22 28 Frozen & Dried Vegetables 22 29 Others

Add WooCommerce coupon code automatically based on product categories

北战南征 提交于 2019-12-06 10:09:07
I am trying to add a coupon code automatically if the cart has products from specific categories. The price must be updated in the Total after showing the discount amount. But I cant see any changes in the total, kindly help me. My code: add_action('wc_cart_product_subtotal' , 'getsubtotalc'); function getsubtotalc ($product_subtotal, $_product, $quantity, $object) { if( is_cart() || is_checkout() ) { global $woocommerce, $product; global $total_qty; /*$coupon_code = 'drawer'; if ( $woocommerce->cart->has_discount( $coupon_code ) ) return;*/ foreach ( $woocommerce->cart->cart_contents as

Magento doesn't show all the categories in admin

泪湿孤枕 提交于 2019-12-06 08:22:03
问题 we have a magento store with various categories one inside another (subcategory). Our problem is that when we enter in the admin to manage categories in the category tree on the left, some of our categories that has subcategories looks correctly with the plus (+) icon on the left but when we try to expand the category magento doesn't display any item. The ajax call point to this url: index.php/admin/catalog_category/categoriesJson/key/09b218741dce69171825fdbf4954855d/?isAjax=true and it

Objective-C Category import strange behavior

本小妞迷上赌 提交于 2019-12-06 08:17:05
I am extending a class from a external library. Here is my code: Header file: Manager+MyCategory.h #import "Manager.h" #import "Element.h" @interface Manager (myCategory) - (Element*) elementWithTag:(NSInteger)tag; @end Implementation file: Manager+MyCategory.h file @implementation Manager (myCategory) - (Element*) elementWithTag:(NSInteger)tag { ... } @end Now here is how I use this category: #import "Manager+MyCategory.h" @implementation myClass - (void) myFunction:(NSInteger)tag { Manager* myManager = [[Manager alloc] init]; Element* = [myManager elementWithTag:tag]; ... [myManager release]

Search posts based on multiple categories WordPress

大兔子大兔子 提交于 2019-12-06 07:15:50
I am working on searching in wordpress i want to search text in multiple categories. here is my code <form method="post" action="<?php bloginfo('home');?>/?ptype=catsearch" > <input type="text" name="searchtext" size="40" /> <h2><?php _e('Categories:'); ?></h2> <select name="category[]" multiple='multiple'> <option value=""><?php echo esc_attr(__('Please Select Your Choice')); ?></option> <?php $categories= get_categories('show_count=0&orderby=name&echo=0&hierarchical=true&depth=1&taxonomy=category&exclude=1'); foreach ($categories as $category) { $option = "<option value=$category->term_id>";

Factorize values across dataframe columns with consistent mappings

五迷三道 提交于 2019-12-06 07:10:41
问题 How can I use pandas factorize with values that exist across two columns? Specifically, I am trying to convert values that exist in two columns to numeric values, and put the corresponding factorized values into new columns, such that the factorization is consistent with the two input columns 'A' and 'B'. Existing DataFrame: A B 0 a b 1 c a 2 d a 3 e c 4 c b 5 b e 6 e f Desired Output: A B A_ID B_ID 0 a b 0 4 1 c a 1 0 2 d a 2 0 3 e c 3 1 4 c b 1 4 5 b e 4 3 6 e f 3 5 I am able to use

Wordpress - Use wp_query in category archive - how to display the appropriate category?

纵然是瞬间 提交于 2019-12-06 07:04:26
问题 I am using wp_query in a category archive so that I can use the meta_query to ignore posts with certain meta values. The problem is that since I am using wp_query, it seems to ignore the category that is currently being viewed and displays all the categories. Is there a way to retrieve the category (perhaps as defined by the url) that the user is viewing and insert it into the wp_query argument array? I've seen this suggested solution on stack overflow, but there must be a simpler way to do

Liferay 7 Freemarker Template. staticUtil has evaluated to NULL or missing - Tried to get JournalArticle's Categories

不问归期 提交于 2019-12-06 06:25:34
Hi fellow Liferay'ers, I'm trying to get the categories of a journalArticle with a Freemarker template. I tried this code: <#assign journalArticleId = .vars['reserved-article-id'].data> <#assign journalArticleResourceLocalServiceUtil = staticUtil["com.liferay.portlet.journal.service.JournalArticleResourceLocalServiceUtil"]> <#assign assetCategoryLocalServiceUtil = staticUtil["com.liferay.portlet.asset.service.AssetCategoryLocalServiceUtil"]> <#assign articleResourcePK = journalArticleResourceLocalServiceUtil.getArticleResourcePrimKey(groupId, journalArticleId)/> <#assign categoryList

How a class extension works as a means of implementing private methods

≯℡__Kan透↙ 提交于 2019-12-06 06:25:06
I believe a popular way to declare "private methods" in Objective-C is to create its class extension and declare methods that you would like to make as private. I would like to know more in detail on how an class extension makes the methods work as private. Update: I asked this question with the term empty category which is incorrect. I now changed it as class extension That's not an "empty category", it's a class extension . Read Bbum's explanation of them at the link I provided. That's because you create your empty category in your implementation file, not your header file so other classes

List items by category

十年热恋 提交于 2019-12-06 05:52:05
I have 3 tables: category doesnt matter item2cat: itemID|catID item: id|name|desc I want to list the items that are in the given category, but I don't know how to do it in a simple way. (With PHP and MySQL) I need this table-structure because I want multiple categories to one item. You probably want to join the item2cat table on your item table: SELECT item.id , item.name , item.desc FROM item INNER JOIN item2cat ON item.id = item2cat.itemID WHERE item2cat.catID = [category_id] or for example SELECT item.id , item.name , item.desc , category.id , category.name FROM item INNER JOIN item2cat ON