Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter skoskie

    (@skoskie)

    For what it’s worth, I found the issue to be incompatibility with a compression setting in the .htaccess file. All compression of the text/html content type had to be removed, which resolved the issue immediately.

    So, remove the bottom line in this block….

    <IfModule filter_module>
        FilterDeclare   COMPRESS
        FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/html

    … and in this block, remove the text/html content type…

    <IfModule !mod_filter.c>
        # Legacy versions of Apache
        AddOutputFilterByType DEFLATE text/html text/plain text/css application/json

    I hope this helps someone in the future.

    Thread Starter skoskie

    (@skoskie)

    Apparently I don’t get notified of responses to my posts. It’s a bit late, but sorry for not responding to questions.

    Thanks @tatumcreative for updating with the updated hooks.

    Thread Starter skoskie

    (@skoskie)

    Answering the question for anyone else who might come across this issue.

    When an item gets added to the cart, a ‘key’ for that individual item in the cart is created based on the item being added and it’s associated meta data. If the item and it’s meta data are identical to another item in the cart, then the generated key will be identical too, and the the quantity of the item already in the cart will simply be incremented by the quantity being added.

    To fix this, you have to hook into the add-to-cart function and add some unique meta data, like so:

    add_filter('woocommerce_add_to_cart_item_data','namespace_force_individual_cart_items',10,2);
    function namespace_force_individual_cart_items($cart_item_data, $product_id)
    {
    	$unique_cart_item_key = md5(microtime().rand()."Hi Mom!");
    	$cart_item_data['unique_key'] = $unique_cart_item_key;
    
    	return $cart_item_data;
    }

    It is important to note that this cart item data (unique_cart_item_key) you have added is only temporary and will not survive a refresh of the page. That’s okay, because now you should be able to retrieve individual items in the cart by using the cart item key created by WooCommerce.

    For instance, you could access each cart item like so:

    foreach ($woocommerce->cart->cart_contents as $cart_key => $cart_item_array) {
    	var_dump($cart_item_array);
    }

    WooCommerce documentation is actually pretty terrible. I hope this helps someone.

    Thread Starter skoskie

    (@skoskie)

    Specific error here:

    Deprecated: Function eregi() is deprecated in /home/hinklelf/hinkle.rsaconnect.com/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/libraries/select_lang.lib.php on line 143
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/hinklelf/hinkle.rsaconnect.com/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/libraries/select_lang.lib.php:143) in /home/hinklelf/hinkle.rsaconnect.com/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/libraries/common.lib.php on line 413
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/hinklelf/hinkle.rsaconnect.com/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/libraries/select_lang.lib.php:143) in /home/hinklelf/hinkle.rsaconnect.com/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/libraries/common.lib.php on line 413
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/hinklelf/hinkle.rsaconnect.com/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/libraries/select_lang.lib.php:143) in /home/hinklelf/hinkle.rsaconnect.com/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/libraries/common.lib.php on line 413
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/hinklelf/hinkle.rsaconnect.com/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/libraries/select_lang.lib.php:143) in /home/hinklelf/hinkle.rsaconnect.com/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/libraries/common.lib.php on line 1062

    In regards to making the fields hidden, just use css.

    [text crc_header id:crc_notification class:hidden "GET_crc"]

    …and then in the style.css file just add …

    .hidden {
         display:hidden;
         }
    Thread Starter skoskie

    (@skoskie)

    I have to state that the reason for this confusion … and now the cause for even more confusion is that this bit of code works just fine:

    <?php get_sidebar('Homepage Column 4'); ?>

    …and there is no file by that name (sidebar-…..php).

    Thread Starter skoskie

    (@skoskie)

    I think I realized what I’ve done. I assumed that get_sidebar could call the name of the sidebar, rather than the name of the file. I had treated the file name as if it didn’t matter.

    But that begs the question, should the file name matter? Why would I use get_sidebar when I could just use dynamic_sidebar instead?

    Thanks for your help.

    Thread Starter skoskie

    (@skoskie)

    Ha. It’s a fair question, but yes I do.

    Thread Starter skoskie

    (@skoskie)

    What’s funny is that if I just include the contents of the sidebar-homepage-column-1.php file it works just fine. Should I just delete the file and put a call to the dynamic sidebar in my index.php file.

    Should I be using dynamic_sidebar instead of get_sidebar??

    Thread Starter skoskie

    (@skoskie)

    It’s a pretty straight forward call:

    <?php get_sidebar('homepage-column-1'); ?>

    … which contains …

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Homepage Column 1') ) : ?>
    
    <!-- dynamic_sidebar("Homepage Column 1") has failed -->
    
    <?php endif; ?>
    Thread Starter skoskie

    (@skoskie)

    Great question. I wasn’t aware of the plural form of that function… I’ve been using several ‘singulars’. But I think that is what I want given by objective of having intuitive sidebar names. From the page you linked to…

    The only times you might need to call this function instead of register_sidebars() are when you want to give unique names to sidebars, such as “Right Sidebar” and “Left Sidebar”

    Here is how I’ve registered the sidebars…

    register_sidebar(array(
    		'name' => 'Default Right Sidebar',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">',
    		'after_widget' => '</div>',
    		'before_title' => '<h2>',
    		'after_title' => '</h2>'
    	));	
    
    	register_sidebar(array(
    		'name' => 'Homepage Column 1',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">',
    		'after_widget' => '</div>',
    		'before_title' => '<h1>',
    		'after_title' => '</h1>'
    	));
Viewing 11 replies - 1 through 11 (of 11 total)