Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter tazziedave

    (@tazziedave)

    biglook

    Sorry to step in like this, but wondering if this is related to my query here?:
    https://www.ads-software.com/support/topic/problem-with-orders-created-by-admin/

    Could be, the change is in class-alg-wc-custom-order-numbers-core.php, line 31 –

    
    class Alg_WC_Custom_Order_Numbers_Core {
    
    		/**
    		 * Constructor.
    		 *
    		 * @version 1.1.1
    		 * @since   1.0.0
    		 * @todo    [feature] (maybe) prefix / suffix per order (i.e. different prefix / suffix for different orders)
    		 */
    		public function __construct() {
    			if ( 'yes' === get_option( 'alg_wc_custom_order_numbers_enabled', 'yes' ) ) {
    				add_action( 'woocommerce_new_order', array( $this, 'add_new_order_number' ), 11 );
    

    They changed the hook. Changing the number at the end of the line from PHP_INT_MAX to 11 worked for me. You could try it and see if it helps.

    Tazziedave

    Thread Starter tazziedave

    (@tazziedave)

    Hi Kenil,

    Thanks for that it works fine.

    Dave

    Thread Starter tazziedave

    (@tazziedave)

    Sorry,

    It’s in response to this hook:

    add_filter( 'woocommerce_add_cart_item', [ $this, 'create_image_in_cart_item' ], 10, 2 );

    The handling, i’m doing is

    
    public function create_image_in_cart_item( $cart_item, $cart_item_key ): array {
    
    // $cart_item['wcp_image_uri'] is base64 png data
    	$imageUri = $cart_item['wcp_image_uri'] ?? false;
    	if ( ! $imageUri ) {
    		return $cart_item;
    	}
    
    	unset( $cart_item['wcp_image_uri'] );  // Don't need this any more
    
    	// Extract info from the data uri and ensure that it seems valid
    	list ( $image_info, $image_base64 ) = explode( ';base64,', $imageUri );
    	$ext = substr( $image_info, - 3 );
    
    	if ( ! $image_base64 || 'png' !== $ext ) {
    		return $cart_item;
    	}
    
    	// Create path and filenames
    	$upload_dir = wp_upload_dir();
    
    	$session_hash = uniqid();
    	$path         = $upload_dir['path'] . "/wcp_item_images/$session_hash";
    
    	$product      = wc_get_product( $cart_item['product_id'] );
    	$product_name = str_replace( ' ', '-', $product->get_name() );
    
    	$filename = "$product_name-$cart_item_key.$ext";
    
    	// Save it if we can
    	try {
    		if ( wp_mkdir_p( $path ) ) {
    			$filename = $path . '/' . $filename;
    		} else {
    			$filename = $upload_dir['basedir'] . '/' . $filename;
    		}
    		file_put_contents( $filename, base64_decode( $image_base64 ) );
    	} catch ( Exception $e ) {
    		return $cart_item;
    	}
    
    	// Create attachment
    	$wp_filetype = wp_check_filetype( $filename );
    	$attachment  = [
    		'post_mime_type' => $wp_filetype['type'],
    		'post_title'     => sanitize_file_name( $filename ),
    		'post_content'   => '',
    		'post_status'    => 'inherit',
    	];
    
    	$attach_id            = wp_insert_attachment( $attachment, $filename );
    	if (! $attach_id) {
    		return $cart_item;
    	}
    	$this->currentImageId = $attach_id;
    	$cart_item['wcp_image_attachment_id']   = $attach_id;
    	$cart_item['wcp_image_filename']   = $filename;
    
    	// Do all image processing and save image formats metadata
            require_once( get_admin_path() . '/includes/image.php' );
    	$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
    	wp_update_attachment_metadata( $attach_id, $attach_data );
    
    	return $cart_item;
    }
    
    • This reply was modified 4 years, 7 months ago by tazziedave. Reason: Replace DS constant shorthand with /

    Hi Mark,

    Here you go:

    Nested Accordion with Tabs Example
    [su_tabs vertical="yes"]
        [su_tab title='Tab 1']
            [su_accordion]
                [su_spoiler title='Tab 1 Spoiler 1' icon='caret' style="fancy"]
                    Tab 1 Spoiler 1 Content
                [/su_spoiler]
                [su_spoiler title='Tab 1 Spoiler 2' icon='caret' style="fancy"]
                    Tab 1 Spoiler 2 Content
                [/su_spoiler]
            [/su_accordion]
        [/su_tab]
    
        [su_tab title='Tab 2']
            [su_accordion]
                [su_spoiler title='Tab 2 Spoiler 1' icon='caret' style="fancy"]
                    Tab 2 Spoiler 1 Content
                [/su_spoiler]
                [su_spoiler title='Spoiler with nested accordion' icon='caret' style="fancy"]
                    [_su_accordion]
                        [su_spoiler title='Tab 2 Nested Spoiler 1' icon='caret' style="fancy"]
                            Tab 2 Nested Spoiler 1 Content
                        [_/su_spoiler]
                        [su_spoiler title='Tab 2 Nested Spoiler 2' icon='caret' style="fancy"]
                            Tab 2 Nested Spoiler 2 Content
                        [_/su_spoiler]
                        [su_spoiler title='Tab 2 Nested Spoiler 3' icon='caret' style="fancy"]
                            Tab 2 Nested Spoiler 3 Content
                        [_/su_spoiler]
                    [_/su_accordion]
                [/su_spoiler]
                [su_spoiler title='Tab 2 Spoiler 3' icon='caret' style="fancy"]
                    Tab 2 Spoiler 3 Content
                [/su_spoiler]
            [/su_accordion]
        [/su_tab]
    
        [su_tab title='Tab 3']
            [su_accordion]
                [su_spoiler title='Tab 3 Spoiler 1' icon='caret' style="fancy"]
                    Tab 3 Spoiler 1 Content
                [/su_spoiler]
                [su_spoiler title='Tab 3 Spoiler 2' icon='caret' style="fancy"]
                    Tab 3 Spoiler 2 Content
                [/su_spoiler]
            [/su_accordion]
        [/su_tab]
    
    [/su_tabs]

    Dave

    I tried to get a three level accordion working but gave up in the end and resorted to using vertical tabs for my top level. See this page for an example. Try Premium layout features|Attributes, Variations and Custom CSS to see the third level.

    Not sure if you could make further tab/accordion/tab/accordion combinations to accomplish what you are trying to do. But if you’re interested I can show you the shortcode markup used to accomplish the above page.

    Dave

    • This reply was modified 7 years, 10 months ago by tazziedave.
    tazziedave

    (@tazziedave)

    Here’s a working 2 level solution – thanks to NightL’s forum solution

    [su_accordion]
    [su_spoiler title="Plain spoiler" style="fancy"]Spoiler level 1[/su_spoiler]
    [su_spoiler title="Click me to see nested accordion" style="fancy"]
      [_su_accordion]
        [su_spoiler title="Nested Spoiler title 1"] Spoiler content level 2[_/su_spoiler]
        [su_spoiler title="Nested Spoiler title 2"] Spoiler content level 2[_/su_spoiler]
        [su_spoiler title="Nested Spoiler title 3"] Spoiler content level 2[_/su_spoiler]
      [_/su_accordion]
    [/su_spoiler]
    [su_spoiler title="Plain spoiler" style="fancy"]Spoiler level 1[/su_spoiler]
    [/su_accordion]

    Note the inner accordion is prefixed by ‘_’ on the open and close tag (may need to change for further nesting) but the inner spoilers are only prefixed by ‘_’ on the close tag!

    tazziedave

    (@tazziedave)

    Thanks for this. It goes against the documentation (and good sense) but it works.

    It also helps with using anything other than the default icon which was forced into the ‘open’ state in sub spoilers. With your fix the icons behave themselves as well.

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