bangbangmobile
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Products only visable for logged in usersThis is not resolved. I understand how to block pages from users who are not logged in, that is not the question.
The question IS:
Can I show a product VARIATION (which is a diff. sku, and diff. price) to Company ABC and HIDE it from Company XYZ? Both are logged in ?? but both have two diff. price points.Thanks,
ChrisForum: Plugins
In reply to: [WooCommerce] Show a different store/products/prices for each logged in user?I feel like it is so close with the variations.php file but it looks like I will just have to create separate products for each Client, then filter the display based on Attribute = Client ABC. I was hoping I could edit the variations.php file above to display the option specifically for the logged in customer, but it’s over my head ??
Thanks for all the help.
Forum: Plugins
In reply to: [WooCommerce] Show a different store/products/prices for each logged in user?I am thinking I need to edit the variation.php file within this section:
<td class="value"><select id="<?php echo esc_attr( sanitize_title($name) ); ?>" name="attribute_<?php echo sanitize_title($name); ?>"> <option value=""><?php echo __('Choose an option', 'woocommerce') ?>…</option> <?php if ( is_array( $options ) ) { if ( empty( $_POST ) ) $selected_value = ( isset( $selected_attributes[ sanitize_title( $name ) ] ) ) ? $selected_attributes[ sanitize_title( $name ) ] : ''; else $selected_value = isset( $_POST[ 'attribute_' . sanitize_title( $name ) ] ) ? $_POST[ 'attribute_' . sanitize_title( $name ) ] : ''; // Get terms if this is a taxonomy - ordered if ( taxonomy_exists( sanitize_title( $name ) ) ) { $terms = get_terms( sanitize_title($name), array('menu_order' => 'ASC') ); foreach ( $terms as $term ) { if ( ! in_array( $term->slug, $options ) ) continue; echo '<option value="' . $term->slug . '" ' . selected( $selected_value, $term->slug, false ) . '>' . apply_filters( 'woocommerce_variation_option_name', $term->name ) . '</option>'; } } else { foreach ( $options as $option ) echo '<option value="' . $option . '" ' . selected( $selected_value, $option, false ) . '>' . apply_filters( 'woocommerce_variation_option_name', $option ) . '</option>'; } } ?> </select> <?php if ( sizeof($attributes) == $loop ) echo '<a class="reset_variations" href="#reset">'.__('Clear selection', 'woocommerce').'</a>'; ?></td>
hmmmmm….
Forum: Plugins
In reply to: [WooCommerce] Show a different store/products/prices for each logged in user?bheadrick, how would I show content based on Variation? So the Attribute is Client, and the Term for this Attribute is Company ABC, Company XYZ, etc. If I only want to show the Company ABC Variation for a logged in user whose Billing Company is equal to Company ABC, can I block all other Variations (like Company XYZ) ?
Forum: Plugins
In reply to: [WooCommerce] Show a different store/products/prices for each logged in user?Ok so I got it to work! The Client logs in, and in the left column of their My Account page, they see only Products that have an Attribute that matches their Company Name. Thank you for the guidance bheadrick!
Now, can I HIDE the Client Attribute so they cannot choose the other Variations, which are other client’s pricing? I assume that is done on the single product page…
Thanks,
ChrisForum: Plugins
In reply to: [WooCommerce] Show a different store/products/prices for each logged in user?Ok so since I was using product_tag instead of the taxonomy, I changed the code to this, but still no luck.
global $current_user; // get logged in user's information get_currentuserinfo(); // get logged in user billing company and convert it to lowercase $billing_company = strtolower($current_user->billing_company); // replace spaces in the billing company with hyphens $company = str_replace( " ", "-", $billing_company); // setup argument $args = array( 'post_type' => 'product', // first, call all products (wooproducts) 'tax_query' => array( // next, run a tax query on the Attributes... array( 'taxonomy' => 'pa_client', // ... on all Client Attributes 'field' => 'slug', // with a slug of... 'terms' => $company // the user's billing company ) ) ); $query = new WP_Query( $args ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
This code is on a custom template assigned to the my-account page so when the user first logs in, they are taken to this page and on the left side they only see a list of items that have their company name as a Variation.
I am so close! ?? Thanks again for the help bheadrick!
Thanks,
ChrisForum: Plugins
In reply to: [WooCommerce] Show a different store/products/prices for each logged in user?Ok so no luck with the following:
<?php global $current_user; get_currentuserinfo(); $company = $current_user->billing_company; query_posts(array('post_type' => 'product', 'product_tag' => '$company')); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php the_title(); ?> <?php endwhile; endif; wp_reset_query(); ?>
To reiterate what I need, since each of my clients will have different pricing on our products, I only want to display Products that have a Variation Attribute that matches my client’s Billing Company. For example, display all products with a variation that equals Company ABC.
I think we are almost there!
Forum: Plugins
In reply to: [WooCommerce] Show a different store/products/prices for each logged in user?bheadrick, so something like this…
$clientposts = new WP_Query(array( 'clients' => 'companyABC' ) ); while ($clientposts->have_posts()) : $clientposts->the_post(); $clientvalue = $clientposts->ID;
I will give it a try!
Thanks,
ChrisForum: Plugins
In reply to: [WooCommerce] Show a different store/products/prices for each logged in user?Ok I think I should be able to add a Client Attribute with a specific price, the next question is can I call a list of products that have a specific attribute? For example, give me all products that have the Client Attribute that equals “Client ABC” ? Is this possible?
Could I also call a list of categories that have products with this attribute?
Forum: Plugins
In reply to: [WooCommerce] Show a different store/products/prices for each logged in user?So the more I think about this the closer I am getting…. could I add custom taxonomies to wooCommerce? I am thinking that if I added a CLIENT taxonomy then gave each client a tax, I could call to the page any client taxonomy that matched the username…. Thoughts?