Forum Replies Created

Viewing 15 replies - 1 through 15 (of 31 total)
  • Thanks Caleb, I it is related, but noted.

    Caleb,I had done.

    All I am trying to do is on the main filter, only load products with a tag called online.

    For instance, I have 1000 products. But I only want to display the ones that have a tag called “online”, which would be 200.

    So when the site loads up, it only shows those 200 products.

    But has to be on the main loop. ??

    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    Mike, I love you. That was it. 100% !! Where do you want me to send some beers to?? !!!

    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    function return_custom_price($price, $product) {
      global $post, $product;
      $post_id = $product->id;
      $postMeta = get_post_meta($post_id, '_wclsi_ls_obj', true);
      $webPrice = $postMeta->Prices->ItemPrice[2]->amount;
    
      return $webPrice;
    
    }
    add_filter('woocommerce_get_price', 'return_custom_price', 10, 2);

    This is what I am trying to use.

    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    Caleb,

    Thanks very much, I thought that might have been the case and had tested it out, but did not work.

    Do you happen to have sample coding I can can a look at? or even better, what do you think the code should be?

    Really appreciate it.

    Many thanks,

    Hey,

    Did you manage to find a solution to this?

    Thanks,

    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    Thanks for the reply.

    I’ll double check the callback, the expected output without the function works ok.

    It’s an interesting issue, logically should be relatively simple.

    I guess I am missing something.

    As for those job boards, I have been burnt several times on there, not been a great experience.

    Thanks

    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    Caleb,

    Thanks for your reply.

    This is the code that I wrote earlier, trying to get around not being able to query the_content() if empty.

    /* Creating a new tab called Description2 this is where we are going to add the custom field.
    	If this is true, it will then call cke_custom_tab_content() and execute, ideally then hiding the description tab, as the custom field superseeds it's information, but we can't have two tabs.
    */
    add_filter( 'woocommerce_product_tabs', 'bhww_woo_extra_tabs' );
    
    	function bhww_woo_extra_tabs( $tabs ) {
    
    		global $post, $post_id;
    		$modifiedtabs = get_post_meta( $post->ID, '_wclsi_ls_obj', true );
    
    		if ( !empty( $modifiedtabs ) ) {
    
    			$tabs['tab1'] = array(
    				'title'    => __( 'Custom-Field-Description', 'woocommerce' ),
    				'priority' => 15,
    				'callback' => 'cke_custom_tab_content'
    
    			);
    			//unset( $tabs['description'] );
    		}
    
    		return $tabs;
    
    	}
    
    /* In here we need to somehow remove the description tab if $mansku is not empty
    	 (trying to get around not being able to query the_content() if empty.
    */
    	function cke_custom_tab_content() {
    
    		  global $post;
    		  $post_id = $post->ID;
    
    		  $postMeta = get_post_meta($post_id, '_wclsi_ls_obj', true);
    		  $mansku = $postMeta->manufacturerSku;
    
    		if ( !empty( $mansku ) ) {
    
    			echo $mansku;
    
    			} else {
    
                echo 'empty';
    
    		};  
    
       }
    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    Caleb,

    Thank you for the reply. I had read otherwise, I did look on WooCommerce’s documentation but it wasn’t immediately obvious. > https://gist.github.com/bhongy/6761732

    If that is the case, any thoughts on how I can best achieve what I am looking for? Logically should not be hard and on raw PHP it would be super easy to implement but I just can’t get it working on WP.

    If you were looking to change the description contents if empty for some custom text/function, how would you go about it?

    Thanks,

    Gabi.

    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    Hey Mike,

    Thank you very much for your response.

    Not working sadly.

    I am placing the code in the description tab.

    <?php
    /**
     * Description tab
     *
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     2.0.0
     */
    
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    global $woocommerce, $post ;
    
    ?>
    
    <?php
    
    if( empty( $post->post_content ) ) { ?>
    
    // show custom function //
    
    <?php } else { ?>
    
    <?php the_content(); ?>
    
    <?php } ?>

    Just doesn’t like it.

    If you look at the screen grab below, it shows what I should be expecting, but it’s simply showing the description as blank on a product which is empty, when it should be showing the bespoke function (custom field)

    https://grab.by/RHFe

    Thanks again, really appreciate it. Can send you some beers ??

    Thank you,

    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    Basically this is what I am trying to do;

    <?php
    
    if (empty($tabs['description'])) {
    
      //if description tab empty then show the contents of a custom function
      <?php showSomething((); ?>
    
    } else {
      //show the contents from the description tab
      <?php the_content(); ?>
    
    }; 
    
    ?>

    ??

    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    Caleb, thanks very much for your reply.

    Say for instance if I swap my function to <?php the_content(); ?> then the issue is still there i’m afraid and behaving as it would with the function I created.

    <?php if(empty($tabs['description'])) { ?> <?php the_content(); ?><?php } ?>

    Additionally, how can I turn it off so that if something is empty in a field, hide the tab?

    Many thanks,

    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    Finding now that WP-Clone does restore the site using this method, but not all the settings are coming across from WordPress which is a little bit annoying and need to ensure I do not miss anything out.

    I am having the same issue.

    It copies most, but for instance the footer it doesn’t apply the right settings and so on.

    Other tools do, but they aren’t as smooth as WP-Clone used to be.

    Any thoughts?

    Thread Starter gabi_cavaller

    (@gabi_cavaller)

    Sincerest apologies, I did not see people had replied to me on here.

    Only got one notification and that was from you 3Dhendo.

    Thanks for responding everyone.

    HI have been somewhat rather unhelpful and simply said that due to the application having a loop, they were not allowing it. I think sometimes they reply in this kind of manner as they don’t know the answer.

    Nevertheless, thank you very much or the workaround 3Dhendo, I Will try that out and let you know, in fact, I should be moving some sites from VPS to shared and can test on there.

    Many thanks,

    G.

Viewing 15 replies - 1 through 15 (of 31 total)