categories

Magento mass-assign products to category

旧时模样 提交于 2019-12-01 08:51:23
As the title says,i need to mass-assign products to a category and from the admin i can only edit one product at a time; i dont know why it just doesnt work to mass add them from the "category products" tab in the category page. Thats why i need another method that's fast,like using phpMyAdmin or something alike. Any help? Thanks in advance! I created a simple script to do this outside of Magento. Be sure to test this first on a single product and make sure it looks as you'd expect. // Load Magento require_once 'path/to/app/Mage.php'; Mage::app(); // $productIds is an array of the products you

WooCommerce Custom Loop to get all product from one specific category

主宰稳场 提交于 2019-12-01 08:08:41
I try to find the code (short code) in the woo comm plugin that made the list of all the product from one category, to be able to modify it... no luck after 1 hours, still no find. So i start coding it myself (reinventing the wheel) and here what i try to get get me all the product from category ID="151" and be able to output the name, the permalink etc etc... this is the code now, that return everything.... way too much ! and i don't know how to filter it { $args = array( 'post_type' => 'product', 'posts_per_page' => 99 ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while (

Mixing different categories results, ordered by score in MySQL

吃可爱长大的小学妹 提交于 2019-12-01 06:30:55
问题 In my PHP application, I have a mysql table of articles which has the following columns: article_id articletext category_id score Each article has a score which is calculated based on how popular it is, and belongs to a specific category (there are around 10 categories available) My question is: how can I perform a query that returns the highest scored articles while alternating them by categories so that if possible, no same-category articles are returned consecutively. For example if the

Using JUnit categories vs simply organizing tests in separate classes

不想你离开。 提交于 2019-12-01 06:28:58
I have two logical categories of tests: plain functional unit tests (pass/fail) and benchmark performance tests that are just for metrics/diagnostics. Currently, I have all test methods in a single class, call it MyTests : public class MyTests { @Test public void testUnit1() { ... assertTrue(someBool); } @Test public void testUnit2() { ... assertFalse(someBool); } @Test @Category(PerformanceTest.class) public void bmrkPerfTest1() { ... } @Test @Category(PerformanceTest.class) public void bmrkPerfTest2() { ... } } Then I have a UnitTestSuite defined as @RunWith(Categories.class) @Categories

Adding a custom field external link to archives category pages

狂风中的少年 提交于 2019-12-01 06:14:49
问题 I have a woocommerce web site. First I would like to add a custom field on admin product pages to set an exernal url that I will use on my Archives category product pages. Also I would like ideally to have this custom field on my admin product pages settings metabox. But the code I have change the link on all archives pages. For now I have this code that is not doing what I need: remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 ); add

Magento mass-assign products to category

邮差的信 提交于 2019-12-01 06:02:34
问题 As the title says,i need to mass-assign products to a category and from the admin i can only edit one product at a time; i dont know why it just doesnt work to mass add them from the "category products" tab in the category page. Thats why i need another method that's fast,like using phpMyAdmin or something alike. Any help? Thanks in advance! 回答1: I created a simple script to do this outside of Magento. Be sure to test this first on a single product and make sure it looks as you'd expect. //

how do i get only 1 post from each category in wordpress

瘦欲@ 提交于 2019-12-01 05:49:49
i have a category named news and many subcategories inside it. What i wanna do is to get only 1 posts(newest) from each of those sub categories(including category title, post title, attachment image). Is there any suggestions friends?? <?php $news_cat_ID = get_cat_ID( 'News' ); $news_cats = get_categories( "parent=$news_cat_ID" ); $news_query = new WP_Query; foreach ( $news_cats as $news_cat ) : $news_query->query( array( 'cat' => $news_cat->term_id, 'posts_per_page' => 1, 'no_found_rows' => true, 'ignore_sticky_posts' => true, )); ?> <h2><?php echo esc_html( $news_cat->name ) ?></h2> <?php

How to add a variable to category in Objective-C? [closed]

好久不见. 提交于 2019-12-01 04:47:30
It's requied to create a category with a new variable (of type NSArray). OriginalClass+Extension.h: @interface OriginalClass (Extension) { NSArray *_array; } @property (nonatomic, retain) NSArray *array; @end But I got the error: Cannot declare variable inside @interface or @protocol . Please help to solve the problem. Rui Peres As the other stated, you can't. Although has H2CO3 pointed out, you can use associative references . On Apple Documents : Note that a category can’t declare additional instance variables for the class; it includes only methods. However, all instance variables within

Using JUnit categories vs simply organizing tests in separate classes

喜夏-厌秋 提交于 2019-12-01 04:47:13
问题 I have two logical categories of tests: plain functional unit tests (pass/fail) and benchmark performance tests that are just for metrics/diagnostics. Currently, I have all test methods in a single class, call it MyTests : public class MyTests { @Test public void testUnit1() { ... assertTrue(someBool); } @Test public void testUnit2() { ... assertFalse(someBool); } @Test @Category(PerformanceTest.class) public void bmrkPerfTest1() { ... } @Test @Category(PerformanceTest.class) public void

Run JUnit Test suite from command line

孤者浪人 提交于 2019-12-01 02:41:14
问题 How do I run a Junit 4.8.1 Test suite from command line ? Also I want to use the categories introduces with JUnit 4.8 , is there a way where I can specify from command line the category which I want to run. 回答1: There is no way (as of 4.8) to specify categories from the command line. 回答2: Using java run JUnitCore class (also see here). Categories are supposed to be used with test suites with @RunWith(Categories.class) , @IncludeCategory and @ExcludeCategory . I am not aware of any dynamic way