product

How to get downloadable product links after successfull order

谁说我不能喝 提交于 2019-12-02 07:12:13
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/product')->setStoreId($order->getStoreId())->load($item->getProductId()); // HERE I NEED FUNCTION TO GET

Order by custom Woocommerce product sorting in a WP_Query

谁都会走 提交于 2019-12-02 07:09:50
I have created a shortcode to display products by category with the query below: $atts = shortcode_atts( array ( 'type' => 'product', 'posts' => -1, 'category' => '', ), $atts, 'list_products' ); $query = new WP_Query( array( 'post_type' => $atts['type'], 'posts_per_page' => $atts['posts'], 'tax_query' => array( array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $atts['category'], ) ), ) ); This is all fine, however I am trying to use the order by attribute when I sort the products using the custom sort shown here I have added: 'orderby' => 'modified', and tried some others from

Disable the “bid” button from WooCommerce product pages for the author

与世无争的帅哥 提交于 2019-12-02 07:04:42
问题 I would like to Removal/disable/hide of "bid" button from product pages in WooCommerce for post authors of the post. I am using WC vendors pro + Woocommerce + Wp Geine Auctions + WC Vendors Auction. Please find the link of the screen shot below: The Live Link to the product How can I do it please? 回答1: As this buttons are already customized by you or some plugins, I am not sure at 100% that it will work for you, even if it works on my test server. The first function is a conditional function

product of list iteratively

梦想的初衷 提交于 2019-12-02 06:56:00
问题 I'm trying to learn coding in Haskell. I started with an easy example "the product of a list". product :: [Integer] -> Integer product [] = 1 product (x:xs) = x * product xs I finished this quickly. Another way is the product function in the API. (product List -> product) I wonder if there is another iterative way to solve my problem? 回答1: You can use a fold: product :: Num a => [a] -> a product xs = foldl (*) 1 xs This can also be done strictly with foldl' or foldr , the differences mostly

Magento - show categories a product is in

不打扰是莪最后的温柔 提交于 2019-12-02 06:39:51
问题 I use the code below to show the categories that a product is in on my productpage. But i run multi-store with the same products and it is showing also the categories of the other websites. How can i only show the categories of the site that i'm visiting? <?php $categories = $_product->getCategoryIds(); ?> <?php foreach($categories as $k => $_category_id): ?> <?php $_category = Mage::getModel('catalog/category')->load($_category_id) ?> <a href="<?php echo $_category->getUrl() ?>"><?php echo $

Customizing the product sale flash badge

送分小仙女□ 提交于 2019-12-02 06:36:00
问题 I am trying to add save amount total on the sale flash badge using this snippet here below but there is something wrong since it is not working. Any advice would be really appreciated. // Add save amount on the sale badge. add_filter( 'woocommerce_sale_flash', 'woocommerce_custom_badge', 10, 2 ); function woocommerce_custom_badge( $price, $product ) { $saved = wc_price( $product->regular_price - $product->sale_price ); return $price . sprintf( __(' <div class="savings">Save %s</div>',

How to hide Woocommerce “out of stock” items price

故事扮演 提交于 2019-12-02 06:08:53
I'd like to display my out of stock items, but without price in WooCommerce. Is there any easy way to hide price of "out of stock" items? Thanks! Adding these to the CSS worked for me. The first one removes the price from the out of stock item's page and the second removes the price from the out of stock item in search results. .outofstock .price{display:none} .outofstock .amount{display:none} Create a file price.php in /your-theme/woocommerce/single-product/ folder. Paste the following code. $pricelabel = ""; - will be the variable that will display instead of the price if the stock quantity

Allow backorders and notify customer for specific product categories in Woocommerce

廉价感情. 提交于 2019-12-02 06:07:51
IN woocommerce I'm trying to add some code in functions.php to allow backorder for specific product categories. But the code doesn't works. How can I allow backorders and notify customer for specific product categories in Woocommerce? Updated Try the following (where you will set your product category(ies) in the array for each function) : add_filter( 'woocommerce_product_is_in_stock', 'filter_product_is_in_stock', 10, 2 ); function filter_product_is_in_stock( $is_in_stock, $product ){ // Here set the products categories in the array (can be terms ids, slugs or names) $categories = array(

Make columns sortable in admin products list panel in Woocommerce

烂漫一生 提交于 2019-12-02 05:35:31
I added the column with the highest value of the offer. And then I would like to make it sortable. I've prepared this: // asl this will add extra column in the product list add_filter( 'manage_edit-product_columns', array($this,'show_product_offers_amounts'),15 ); add_action( 'manage_product_posts_custom_column', array($this,'show_product_offers_amount_max'), 10, 2 ); // asl show the column function show_product_offers_amounts($columns){ $columns['orig_offer_amount'] = 'Amount'; return $columns; } // asl add the datas to column function show_product_offers_amount_max( $column, $postid ) {

Magento - show categories a product is in

末鹿安然 提交于 2019-12-02 05:31:25
I use the code below to show the categories that a product is in on my productpage. But i run multi-store with the same products and it is showing also the categories of the other websites. How can i only show the categories of the site that i'm visiting? <?php $categories = $_product->getCategoryIds(); ?> <?php foreach($categories as $k => $_category_id): ?> <?php $_category = Mage::getModel('catalog/category')->load($_category_id) ?> <a href="<?php echo $_category->getUrl() ?>"><?php echo $_category->getName() ?> | </a> <?php endforeach; ?> faizanbeg Check loaded category id is exist or not