product

How to get downloadable product links after successfull order

巧了我就是萌 提交于 2019-12-04 05:14:38
问题 After a successfull order I would like to propose directly the downloadable URL for products buyer bought in the success.phtml file. I wrote this piece of code to know product's values of the latest order: // Get the latest Order ID $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId()); // Get every products on the latest order $items = $order->getAllItems(); // Loop the products foreach ($items as $item){ $product = Mage::getModel('catalog

Move product title above product image on Woocommerce archive pages

南笙酒味 提交于 2019-12-04 04:54:03
问题 I am trying to move the product title above the product image on the product archive page. I have managed to figure out how to move the information, but the price is moving above the image aswell. I want only the product title to be above the product image. The price should remain below, with the add to cart button etc. Here is my code snippet and screenshot of result so far: remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 ); add

MySQL help: How to find all orders from a customer till price <= 20 and status='unpaid'

风流意气都作罢 提交于 2019-12-04 02:42:49
问题 I think my question will be understood better by providing the following example: i have a table with following data: orderid Price username paymentstatus 1 10 john unpaid 2 10 john unpaid 4 10 john unpaid 5 10 john unpaid 6 10 sam unpaid 7 10 john unpaid 8 10 john paid I want to find all orders of (username) john where paymentstatus is "unpaid" and price total is <= 20 So the result should show following 2 lines (as order total is $20 and payment status is unpaid and username is john)

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

≡放荡痞女 提交于 2019-12-04 02:06:09
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(); $quoteItem->addOption(array( 'product_id' => $product->getId(), 'product' => $product, 'code' =>

woocommerce notice product_type was called incorrectly . Product properties should not be accessed directly

拈花ヽ惹草 提交于 2019-12-04 01:38:29
问题 I'm having this notice with all products on shop page after updating WooCommerce version to 3.0. Notice: product_type was called incorrectly . Product properties should not be accessed directly. Please see Debugging in WordPress for more information. (This message was added in version 3.0.) in C:\xampp\htdocs\oye\wp-includes\functions.php on line 4137 any idea how to fix it? 回答1: The product_type property is deprecated. Use get_type() to get internal type. So you need to change this: $product

Remove featured image from the WooCommerce gallery

百般思念 提交于 2019-12-04 01:24:46
问题 I tried using suggestions from other posts but they do not work. I am looking to not show the featured product image in my product images area/image gallery because I am using the featured image in the header as a background image and its too wide to be in the gallery. So far this is the closest thing to working but I get an error. It does however do what I need. Any way to fix this so i do not get the error? Here is my code: add_filter('woocommerce_single_product_image_thumbnail_html',

How do display products by category in CMS page in Magento?

旧街凉风 提交于 2019-12-03 21:32:44
i have one page with the name "products". in this page i need to display all the items seperated by it's corresponding category name. the structure looks like below category 1 item1 item2 category 2 item1 item2 how can i do this? {{block type="catalog/product_list" category_id="8" template="catalog/product/featured.phtml"}} add above code in cms page and add featured.phtml file in catalog/product and put this code <?php $_productCollection=$this->getLoadedProductCollection() ?> <?php if(!$_productCollection->count()): ?> <div class="note-msg"> <?php echo $this->__('There are no products

Woocommerce - Only show grouped products parent in the loop

夙愿已清 提交于 2019-12-03 20:32:21
I'm building a store for books. I have a bunch of grouped products . My pain is, that woocommerce lists both type by default. I only need the parent of the group to be listed without childrens . Is there any hook or workaround for this? Thanks. Try the following: add_action( 'woocommerce_product_query', 'so_27975262_product_query' ); function so_27975262_product_query( $q ){ $q->set( 'post_parent', 0 ); } The idea is that we're modifying the query such that it will only show top-level items.... thus (in theory) nothing that has been assigned to a group, which would then have the group product

WooCommerce - Getting completed status orders by user in a period of time

断了今生、忘了曾经 提交于 2019-12-03 20:21:59
I need to get a user's done purchases in the last month by USER ID in Woocommerce. Users have levels (Gold, Silver): Gold members can purchase 4 items each month; Silver members can buy 1 item per month. I need to check this before adding an item to the cart. I don't want to use a plugin for just this feature (which could not found, BTW). Is that possible? How can I achieve this? Thanks LoicTheAztec It's possible to get the total items count bought by the current customer in the past 30 days . Here is the code of this function based on this answer : function current_customer_month_count( $user

Magento - get product collection of all products

跟風遠走 提交于 2019-12-03 20:14:38
I need a custom product collection of all products. Currently there are no categories which contain all products of the store (as there are 8000 products we can not add them in to one extra category). What I need is on a particular CMS page the product collection of all products is displayed. So far I have a CMS page with the block: {{block type="catalog/product_list" template="catalog/product/list.phtml"}} I have created an module to override 'Mage_Catalog_Block_Product_List' I believe the function I need to edit would be 'protected function _getProductCollection()' As we can see in the block