• Resolved SaladGoat

    (@saladgoat)


    On the Store page, customers can scroll down and down and down and go crazy, Adding everything to their Cart. Impulse buying, yay!

    But if a product has variations, they are instead presented with a Choose Option button, which takes them off the Store page to the individual product page. Now maybe they forget to go back to the Store.

    Is there a way to add the Options dropdown box onto the Store page please? Then they can make their choice and keep scrolling and finding other things they didn’t know they needed. 😉

    Please and thank you. 🙂

    https://ww.wp.xz.cn/plugins/wordpress-ecommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Predrag – WPMU DEV Support

    (@wpmudev-support1)

    Hi @saladgoat,

    I hope you are well today and thank you for your question.

    To achieve this create a file functions.php in your WordPress directory wp-content/mu-plugins( Create it if not exist ) containing the following code.

    <?php
    
    if (!function_exists('_mp_products_html_grid')) :
    function _mp_products_html_grid( $custom_query ) {
    
    		global $mp,$post;
    		$html = '';
    		$current_post = $post;
    
    		//get image width
    		if ($mp->get_setting('list_img_size') == 'custom') {
    				$width = $mp->get_setting('list_img_width');
    		} else {
    				$size = $mp->get_setting('list_img_size');
    				$width = get_option($size . "_size_w");
    		}
    
    		$inline_style = !( $mp->get_setting('store_theme') == 'none' || current_theme_supports('mp_style') );
    
    		while ( $custom_query->have_posts() ) : $custom_query->the_post();
    			$img = mp_product_image(false, 'list', $post->ID);
    			$excerpt = $mp->get_setting('show_excerpt') ?
    							'<p class="mp_excerpt">' . $mp->product_excerpt($post->post_excerpt, $post->post_content, $post->ID, '') . '</p>' :
    							'';
    			$mp_product_list_content = apply_filters('mp_product_list_content', $excerpt, $post->ID);
    
    			$pinit = mp_pinit_button($post->ID, 'all_view');
    
    			$class = array();
    			$class[] = strlen($img) > 0 ? 'mp_thumbnail' : '';
    			$class[] = strlen($excerpt) > 0 ? 'mp_excerpt' : '';
    			$class[] = mp_has_variations($post->ID) ? 'mp_price_variations' : '';
    			$context = mp_has_variations($post->ID) ? 'single' : 'list';
    			$html .= '
    				<div itemscope itemtype="http://schema.org/Product" class="hentry mp_one_tile ' . implode($class, ' ') . '">
    					<div class="mp_one_product"' . ($inline_style ? ' style="width: ' . $width . 'px;"' : '') . '>
    						<div class="mp_product_detail"' . ($inline_style ? ' style="width: ' . $width . 'px;"' : '') . '>
    							' . $img . '
    							' . $pinit .'
    							<h3 class="mp_product_name entry-title" itemprop="name">
    								<a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a>
    							</h3>
    
    							<div>' . $mp_product_list_content . '</div>
    						</div>
    
    						<div class="mp_price_buy"' . ($inline_style ? ' style="width: ' . $width . 'px;"' : '') . '>
    							' . mp_product_price(false, $post->ID) . '
    							' . mp_buy_button(false, $context, $post->ID) . '
    							' . apply_filters('mp_product_list_meta', '', $post->ID) . '
    						</div>
    
    						<div style="display:none" >
    							<span class="entry-title">' . get_the_title() . '</span> was last modified:
    							<time class="updated">' . get_the_time('Y-m-d\TG:i') . '</time> by
    							<span class="author vcard"><span class="fn">' . get_the_author_meta('display_name') . '</span></span>
    						</div>
    					</div>
    				</div>';
    		endwhile;
    
    		$html .= ($custom_query->found_posts > 0) ? '<div class="clear"></div>' : '';
    
    		$post = $current_post; //wp_reset_postdata() doesn't work here for some reason
    
    		return apply_filters('_mp_products_html_grid', $html, $custom_query);
    }
    endif;
    
    if (!function_exists('_mp_products_html_list')) :
    function _mp_products_html_list( $custom_query ) {
    		global $mp,$post;
    		$html = '';
    		$total = $custom_query->post_count;
    		$count = 0;
    		$current_post = $post;
    
    		while ( $custom_query->have_posts() ) : $custom_query->the_post();
    				$count = $custom_query->current_post + 1;
    
    				//add last css class for styling grids
    				if ($count == $total)
    						$class = array('mp_product', 'last-product', 'hentry');
    				else
    						$class = array('mp_product', 'hentry');
    
    				$html .= '
    					<div itemscope itemtype="http://schema.org/Product" ' . mp_product_class(false, $class, $post->ID) . '>
    						<h3 class="mp_product_name entry-title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h3>
    						<div class="entry-content">
    							<div class="mp_product_content">';
    
    				$product_content = mp_product_image(false, 'list', $post->ID);
    				if ( $mp->get_setting('show_excerpt') ) {
    					$product_content .= $mp->product_excerpt($post->post_excerpt, $post->post_content, $post->ID);
    				}
    
    				$html .= apply_filters('mp_product_list_content', $product_content, $post->ID);
    				$html .= mp_pinit_button($post->ID,'all_view');
    				$html .= '
    							</div>
    							<div class="mp_product_meta">';
    
    				$context = mp_has_variations($post->ID) ? 'single' : 'list';
    				//price
    				$meta = mp_product_price(false, $post->ID);
    				//button
    				$meta .= mp_buy_button(false, $context, $post->ID);
    				$html .= apply_filters('mp_product_list_meta', $meta, $post->ID);
    				$html .= '
    							</div>
    						</div>
    						<div style="display:none">
    							<time class="updated">' . get_the_time('Y-m-d\TG:i') . '</time> by
    							<span class="author vcard"><span class="fn">' . get_the_author_meta('display_name') . '</span></span>
    						</div>
    					</div>';
    		endwhile;
    
    		$post = $current_post; //wp_reset_postdata() doesn't work here for some reason
    
    		return apply_filters('_mp_products_html_list', $html, $custom_query);
    }
    endif;

    Best Regards,
    WPMU DEV

    Thread Starter SaladGoat

    (@saladgoat)

    Works great – thanks!

    Plugin Support Predrag – WPMU DEV Support

    (@wpmudev-support1)

    You are most welcome, if i can be of any further assistance please don’t hesitate to ask 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘request: order on same page’ is closed to new replies.