Gooly
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Add to cart button dissapeared after changing product typeHere is some code:
content-single-product.php
<?php /** * The template for displaying product content in the single-product.php template * * Override this template by copying it to yourtheme/woocommerce/content-single-product.php * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> <?php get_header(); ?> <?php get_template_part( 'content', 'header' ); ?> <div class="container pos-rel "> <?php get_template_part( 'content', 'nav' ); ?> <div class="container"> <div class="row maincontent"> <div class="col-sm-3"> <?php $terms = get_the_terms( $post->ID, 'product_cat' ); foreach ( $terms as $term ){ $category_name = $term->name; $category_thumbnail = get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true); $image = wp_get_attachment_url($category_thumbnail); echo '<img class="absolute attachment-post-thumbnail category-image" width="280" height="160" src="'.$image.'" alt="category image">'; } ?> <?php if ( is_active_sidebar( 'product_sidebar' ) ) : ?> <class id="sidebar"> <?php dynamic_sidebar( 'product_sidebar' ); ?> </class> <?php endif; ?> </div><!-- col-sm-3 --> <div class="col-sm-9"> <?php woocommerce_breadcrumb(); ?> <?php /** * woocommerce_before_single_product hook * * @hooked wc_print_notices - 10 */ do_action( 'woocommerce_before_single_product' ); if ( post_password_required() ) { echo get_the_password_form(); return; } ?> <div class="product-header"> <?php woocommerce_template_single_title(); ?> <p class="product-meta"> <?php global $product; _e('Article ref. '); echo $product->get_sku(); ?> </p> </div> <div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>" <?php post_class(); ?>> <?php /** * woocommerce_before_single_product_summary hook * * @hooked woocommerce_show_product_sale_flash - 10 * @hooked woocommerce_show_product_images - 20 */ do_action( 'woocommerce_before_single_product_summary' ); ?> <div class="summary entry-summary"> <?php /** * woocommerce_single_product_summary hook * * @hooked woocommerce_template_single_title - 5 * @hooked woocommerce_template_single_rating - 10 * @hooked woocommerce_template_single_price - 10 * @hooked woocommerce_template_single_excerpt - 20 * @hooked woocommerce_template_single_add_to_cart - 30 * @hooked woocommerce_template_single_meta - 40 * @hooked woocommerce_template_single_sharing - 50 */ do_action( 'woocommerce_single_product_summary' ); ?> <?php // wd_featured_products(); ?> </div><!-- .summary --> <?php /** * woocommerce_after_single_product_summary hook * * @hooked woocommerce_output_product_data_tabs - 10 * @hooked woocommerce_upsell_display - 15 * @hooked woocommerce_output_related_products - 20 */ do_action( 'woocommerce_after_single_product_summary' ); ?> <meta itemprop="url" content="<?php the_permalink(); ?>" /> </div><!-- #product-<?php the_ID(); ?> --> <?php do_action( 'woocommerce_after_single_product' ); ?> </div><!-- col-sm-9 --> </div><!-- row --> <?php get_template_part( 'content', 'footer' ); ?> </div><!-- container --> </div>woo_functions.php
<?php /** * - Woocommerce - * get featured products * returns: * $array[integer][data] * $array[integer][image] */ function wd_get_featured_products_raw() { $args = array( 'post_type' => 'product', 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_status' => 'publish' ); $i = 0; $featured_query = new WP_Query( $args ); if ($featured_query->have_posts()) : echo '<p>I have posts</p>'; while ($featured_query->have_posts()) : $featured_query->the_post(); $products[$i]['data'] = get_product( $featured_query->post->ID ); if ( has_post_thumbnail()) { $attr = array( 'alt' => trim( strip_tags( $featured_query->post->post_title ) ), 'title' => trim( strip_tags( $featured_query->post->post_title ) ), ); $products[$i]['image'] = get_the_post_thumbnail($featured_query->post->ID,array (253,141), $attr); } $i++; endwhile; endif; wp_reset_query(); if (!empty($products)) { return $products; } else { return false; } } /** * - Woocommerce - * Output featured products more gracefully * returns: * $output[integer][thumbnail] * $output[integer][permalink] * $output[integer][title] * $output[integer][content] */ function wd_get_featured_products() { $products = wd_get_featured_products_raw(); if ( sizeof($products) < 1 or !is_array($products) ) { return false; } $i = 0; foreach ($products as $product) { $output[$i]['thumbnail'] = $product['image']; $output[$i]['permalink'] = $product['data'] -> post ->guid; $output[$i]['title'] = $product['data'] -> post -> post_title; $output[$i]['content'] = $product['data'] -> post -> post_excerpt; $i++; } return $output; } /** * - Woocommerce - * echo featured products (for theme frontpage) * returns ture or false */ function wd_featured_products( $htag = 'h3', $class = '' ) { $products = wd_get_featured_products(); $lnbr = "\n"; if ( empty($products) ) { return false; } else { foreach ($products as $product) { echo '<section class="featured-product-section'; if ( !empty($class) ) { echo ' ' . $class; } echo '">' . $lnbr ; echo '<' . $htag . ' class="featured-product-header"><a href="' . $product['permalink'] . '">' . $product['title'] . '</a></' . $htag . '>' . $lnbr; echo '<div class="featured-product-image">' . $lnbr; echo '<a href="' . $product['permalink'] . '">' . $product['thumbnail'] . '</a>' . $lnbr; echo '</div>' . $lnbr; echo '<p>' . $product['content'] . '</p>' . $lnbr; echo '<p><a title="'. $product['title'] .'" href="' . $product['permalink'] . '">' . __('More') . ' <span class="glyphicon glyphicon-circle-arrow-right"></span></a></p>' . $lnbr; echo '</section>' . $lnbr ; } return true; } } /** * - Woocommerce - * Remove breadcrumbs */ add_action( 'init', 'jk_remove_wc_breadcrumbs' ); function jk_remove_wc_breadcrumbs() { remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); } /** * - Woocommerce - * Remove all tabs on single product page */ remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); /** * - Woocommerce - * (re)Publish Product description (after removing all tabs) */ function woocommerce_template_product_description() { woocommerce_get_template( 'single-product/tabs/description.php' ); } add_action( 'woocommerce_single_product_summary', 'woocommerce_template_product_description', 20 ); /* * wc_remove_related_products * * Clear the query arguments for related products so none show. * Add this code to your theme functions.php file. */ function wc_remove_related_products( $args ) { return array(); } add_filter('woocommerce_related_products_args','wc_remove_related_products', 10); /** * Hide prices */ remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // < 2.1 /** * Change add to cart button text */ add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 + function woo_custom_cart_button_text() { return __( 'Add to quote request', 'woocommerce' ); } /** * Display category image */ function woocommerce_category_image() { if ( is_product_category() ){ global $wp_query; $cat = $wp_query->get_queried_object(); $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); $image = wp_get_attachment_url( $thumbnail_id ); if ( strlen($image) >= 3 ) { echo $image; } else { echo get_template_directory_uri() . '/images/tegelsrechtsboven.png'; } } } /** * Remove "Sale" button from products */ remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 ); remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 ); ?>Forum: Plugins
In reply to: [WooCommerce] Add to cart button dissapeared after changing product typeHi Lorro. Maybe I’m not understanding what you meant by “The variation shown in your original screen shot was not valid because it had no attributes set.”
In the second screenshot (http://s27.postimg.org/zc7d64etf/screenshot2.jpg) there are attributes selected (however they are set as defaults). Also if I select or change them manually by clicking the dropdowns, no add to cart button shows up.It’s not an existing theme BTW. I am developing it. Since I never developed a WC theme before, my approach is to copy the templates from the plugin to the theme directory, change the looks by copy the original template code into my theme wrappers, and creating an extra (woo_functions.php) file to extend functions.php, where I eventually change the WC hooks.
[edit]If I change the them to twenty-fourteen, the button does show up, so it’s probably theme related(?)[/edit]
Forum: Plugins
In reply to: [WooCommerce] Add to cart button dissapeared after changing product typeP.S.
I noticed that the Add to cart button (In my theme ‘add to quote request’ button) is in the generated code. It’s just hidden by display:none in the ‘single_variation_wrap’ div:
http://s27.postimg.org/zc7d64etf/screenshot2.jpgForum: Plugins
In reply to: [WooCommerce] Add to cart button dissapeared after changing product typeThanks, I did get the stock controls back. I noticed that the product in the products overview page (Products / products) showed ‘Out of stock’
I added stock and now I can see the add to cart button. However only if I change to another theme (twenty-fourteen). So I probably have an issue with my theme.
(Which is kind of strange, because yesterday I was able to see it in my own theme if the product was ‘simple’, but today not anymore. But than again, I tried so many things that it is quite plausible that I changed something there)
So my new scope will be bound to my theme (functions)Btw to explain a bit more about the entire setup and why I don’t configure all possible variations:
I’m building this shop to be used as an extended catalog, not as a shop. The entire check out procedure is more used as a ‘request a quote’ procedure and the ‘add to cart’ button label will be replaced with ‘add to quote request’. Also prices will also be hidden.
So the shop owner doesn’t respond with sending the order, but responds by sending a quote and some more data like when the products will be available.This may sound a bit devious, but it is my plan B.
Plan A was looking for a solution how to to turn a Woocommerce webshop in a catalog. (I couldn’t imagine that I would be the only one who wanted to do this) I asked that question on several places, but I got no reply at all (Like here: https://wordpress.org/support/topic/offer-functionality-for-woocommerce)
Than I realized that what I want is more a a stripped down variant of a regular checkout procedure, so I decided to do it this way.Thanks again Lorro and Mike
Forum: Plugins
In reply to: [WooCommerce] Add to cart button dissapeared after changing product typeThanks for your reply Lorro. Unfortunately it’s running on my local webserver with no connection to the internet.
I have a screenshot of the variations tab, where I noticed that the inventory field is simply missing:
http://postimg.org/image/b156cc7r5/
If you want another screenshot, just ask.Forum: Plugins
In reply to: [WooCommerce] Offer functionality for WooCommerceSomeone pointed out to me that my question could be confusing. So let me rephrase my question;
How can I configure Woocommerce to hide the product prices and let customers be able to send a (request for a) quote for their product selection, rather than an order?
Forum: Plugins
In reply to: [The Events Calendar] Events calendar does not obey general date settingsIt certainly does, it works like a charm.
Thanks!Forum: Fixing WordPress
In reply to: Determine which sidebar to loadYes, that’s how I named them
If I call them directly: <?php get_sidebar(“menu”); ?>
Than everything works. (filename sidebar-menu.php)But when I do:
<?php $pageid = $wp_query->post->ID; $sidebar = pick_sidebar($pageid); echo "Sidebarname: ".$sidebar; get_sidebar($sidebar); ?>this results in:
Sidebarname: menu
And the default sidebar is displayed.Forum: Installing WordPress
In reply to: Two WP instances, but one failsHi govpatel
Thanks for your reply.
In a next stage we will add another domainname for this second website
So does this mean that it will work correctly after we have added the second domainname and point it to the wpress directory?I understand now why it fails when we use the old domainname.
Forum: Fixing WordPress
In reply to: A separator between articles on a static pageIt works like a charm. Thanks! The idea of using a shortcode never came to my mind. But I also never worked with (WP) shortcodes before.
I have the feeling that this is not just a solution for now, but also for eventually problems in the future 🙂Forum: Fixing WordPress
In reply to: How to acces worpress databaseThanks! You helped me a lot further on this 🙂