product

Get is_purchasable hook working for Woocommerce product variations too

百般思念 提交于 2019-12-05 23:34:26
I have made 2 custom product fields - availability - since when/until when. So if the current date is between these set availability dates then product is purchasable, else - it's not. Everything works perfectly however only until I post a product with a variations. Then it's like product variations ignore these custom availability fields/values and still let to add variations to cart even if current date is not between set availability dates. function hide_product_if_unavailable( $is_purchasable, $object ) { $date_from = get_post_meta( $object->get_id(), '_availability_schedule_dates_from' );

Sort order of related products not working in Magento 1.6

青春壹個敷衍的年華 提交于 2019-12-05 22:22:25
I want Magento to sort my related products by the position value I'm giving them in the back-end. When I try to do that, nothing happens; the related products are still sorted by ID and not by position. I checked the configuration Catalog & rarr; Article sort by & rarr; Position and it seems to be fine. In Magento version 1.7.1 this bug has been fixed $this->_itemCollection = $product->getRelatedProductCollection() ->addAttributeToSelect('required_options') ->setPositionOrder() ->addStoreFilter() ; under Mage_Catalog_Block_Product_List_Related function _prepareData change from $this->

WooCommerce Custom product type - Multiple add to cart sections issue

旧街凉风 提交于 2019-12-05 20:51:42
I've created a custom product type in woocommerce called Booking. Here is the code that I have: class WC_Product_Booking extends WC_Product{ /** * __construct function. * * @access public * @param mixed $product */ public function __construct( $product ) { $this->product_type = 'booking'; $this->supports[] = 'ajax_add_to_cart'; parent::__construct( $product ); add_action('woocommerce_booking_add_to_cart', array($this, 'add_to_cart'),30); } private function show_pricing_fields(){ ?><script type='text/javascript'> jQuery( document ).ready( function() { jQuery( '.options_group.pricing' ).addClass

Bundle Product add to cart as individual line items

♀尐吖头ヾ 提交于 2019-12-05 20:24:21
Is it possible to have a bundle product that when added to the cart adds each of the bundle items as individual line items. I want to allow my customers to configure their product (let’s say it’s a computer) and then in the shopping cart, remove an item they don't want - or change their mind about - from that bundle. They might then choose to add a new item instead - or a bunch of other (non-bundle stuff, just normal shopping). The idea being that they have a fast method of adding most of the stuff they want in this bundle, but they can then edit their cart to add something that wasn’t

How to enable Software Update in an Eclipse product?

孤人 提交于 2019-12-05 19:30:01
In my Eclipse project, I defined a simple plugin (bundle), a feature that includes the plugin and a product that includes the feature. When I export the poduct (via the "Eclipse Product export wizard" of the product editor), it does build the product. I can launch the product, everything works fine (the plugin is there and doing what it is supposed to do). The only problem is that the user of the product cannot install additional Eclipse features using the Software Update menu (Help -> Software Updates). The Software Updates sub-menus ("Find and Install..." and "Manage Configuration...") are

WooCommerce Variation Images not displaying

情到浓时终转凉″ 提交于 2019-12-05 19:29:17
On the single product page, when I select a color, the featured image doesn't change. WordPress has been updated to 4.6.1, WooCommerce to 2.6.2, and the Storefront theme to 2.1.2. I have deactivated all plugins except WooCommerce and am using the Storeront theme exactly as I installed it. I cleared all caches, cleared my browser cache (Chrome, latest version),and even went so far as to re-enter all variation images for a single product. Further testing hs yielded the same result. I have no PHP errors, no errors in Dev tools, and no errors in WooCommerce System Status. After searching through a

Add a custom option to a quote item (product in the cart)?

巧了我就是萌 提交于 2019-12-05 16:56:52
问题 I'm running Magento 1.7. I'm trying to add a quote item option, a custom one, in sales_flat_quote_item_option. I have tried with addOption and addCustomOption functions, but it seems no query is launched to the database. This is my code right now (in a custom module helper) : public function assignDocumentToQuoteItem(Mage_Sales_Model_Quote_Item $quoteItem, $documentid) { if (is_numeric($documentid) && $documentid > 0) { /** @var Mage_Catalog_Model_Product */ $product = $quoteItem->getProduct(

WooCommerce - Custom thumbnails and default fall back image placeholder

て烟熏妆下的殇ゞ 提交于 2019-12-05 16:11:53
I just want to insert a wrapper to the woocommerce_get_product_thumbnail I can see that my wrapper appeared but It doesn't have a fall back image if there's no image. How do I output the default woocommerce thumbnail? This is my incomplete code: remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10); add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10); if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) { function woocommerce_template_loop_product_thumbnail() { echo

Dynamically calculate product price based on custom fields values when added-to-cart

微笑、不失礼 提交于 2019-12-05 15:24:01
I found the code to add existing product: global $woocommerce; $woocommerce->cart->add_to_cart(16); But I need to add product, with price that determined by 2 inputs: Age Quality I calculate the product's price by the formula age*quality. I know it's possible to add product with variations, but it's so many possible variations. Is it possible to set the product price dynamically based on custom fields calculation values? Thanks For the cart items (when product is added-to cart), is possible to set a custom dynamic calculated price based on product custom fields values. 1) First we add in the

Change Magento product status in different store views

落花浮王杯 提交于 2019-12-05 13:43:20
I have a Magento Multi-Store installation. I have a product that must be enabled in shopA and disabled in shopB If i select the tab "Websites" there is an alert "Items that you don't want to show in the catalog or search results should have status 'Disabled' in the desired store." so probably it is possible? The default value status of the product is "enabled" Then i select the store view of shopB and disabled the product status. Now the status of the product in shopA is also disabled. Is it possible to set the product status in shopA to enabled en in shopB to disabled? The manual said: "The