Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter marqueteur

    (@marqueteur)

    For the time being, that will probably suffice, given that where I am the flat rate boxes are almost invariably the cheaper option when things fit (yes, even when things are very light, which most of my stuff is), and everything I’ll be adding soon is small.

    With larger items, I wouldn’t want to only offer Express Mail, since that would be hideously expensive.

    Even looking at your screenshot, it doesn’t make sense to me that “Priority Mail, seller’s packaging” and “Priority Mail, carrier’s packaging” are internally treated as different options from the customer’s point of view, since they are in the same section of shipping options.

    Thread Starter marqueteur

    (@marqueteur)

    The problem is, it makes sense to ship in either flat rate boxes or a different box, and I want to ship by priority mail items which can’t fit in flat rate boxes.

    What doesn’t make sense is to show the customer more than one option from the Priority Mail section of shipping options, because there is no difference in how long it will take for them to receive their package. It only matters on my end in terms of which box I will actually use to pack their order.

    Thanks for the answer on the shipping boxes. It’s clear now.

    • This reply was modified 6 years, 8 months ago by marqueteur.

    Ah. I think what is going on is that the if statement I pulled from my code is already in variable.php, so when you call $terms it already has a properly trimmed list. In that case said if statment is redundant and should be removed to (theoretically) speed up processing.

    Do you happen to know if the product image change on attribute selection can be done in PHP/HTML, or if it is definitely JS or other script?

    Just got back. IIUC, you now have only the specific attributes used for the product displayed instead of the entire global list displayed before with your original code. Is this so?

    I’m just starting to look at product-image.php to see if I can find the hook we need.

    Tor

    Can’t say as I’ve gotten to figuring out which bit of code you need. I’ve spent the time I’ve had since finding your post figuring out how to get a nice list of colours and descriptions to show under the additional information tab – which I’ve just managed and need to prettify a bit.

    The relevant section of my code is at the bottom of my post (I think I’ve got a few statements that don’t do anything useful to prune, still). This bit, though, about two thirds through is the key bit for getting only relevant colours rather than all colours:

    if ( ! in_array( $term_name, $values ) )
    				      continue;

    I’ll take a look for the image section soon. I pulled the interesting bits for this mostly from $woocommerce/templates/single-product/add-to-cart/variable.php . Somewhere in $single-product/ probably exists the image loading code, and somewhere in that would be my first guess location for the useful code – though what is there may be a call to a function that exists elsewhere. That function may be all you need, though.

    Now that I’ve seen what you are trying to do I want it too, but it’ll probably be an hour or two before I get back to looking. With my (very) limited PHP experience I’m shooting in the dark a bit.

    Tor

    if ( $attribute['name'] == 'pa_color' ) {
    				    echo "<dl>";
    				    $args = array( 'orderby' => 'name', 'hide_empty' => false, 'menu_order' => false );
    				    $terms = get_terms( 'pa_color', $args );
    				    $values = woocommerce_get_product_terms( $product->id, $attribute['name'], 'names' );
    				    foreach ( $terms as $term ) :
    				    $term_name = $term->name;
    				    if ( ! in_array( $term_name, $values ) )
    				      continue;
    				    $term_desc = $term->description;
    				    echo "<dt>$term_name <dd> $term_desc";
    				    endforeach;
    				    echo "</dl>";
    				  }

    Just found this – after trying for quite a while to even get hold of the attribute descriptions. Haven’t gotten to test your code yet (and won’t until morning), but I suspect the code you need to add (or similar) most likely resides in the code used to change the featured image when selecting a variation when selecting that variation.

    I’ll be looking into this more tomorrow.

    Tor

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