• Resolved koolkatwebdesigns

    (@koolkatwebdesigns)


    1. If I implement jigoshop\shop\list\product\after_title action and try to get the product from the post id, I always get back the post id for the first product on the page. Is there a better way to do this or are there examples of implementing this action?
    2. If I know the slug of an attribute, can I retrieve that attribute directly from the product?

    thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • 1. How are you implementing the action?
    2. No – but knowing the id of the attribute would ?? Also – you can get the full list of attributes ??

    Thread Starter koolkatwebdesigns

    (@koolkatwebdesigns)

    I’m sure there is a better way but this is what I tried:
    global $post;
    $composer = ”;
    $product = \Jigoshop\Integration::getProductService()->find($post->ID);
    $attributes = $product->getAttributes( );
    foreach ($attributes as $attribute) {
    if (‘composer’ == $mp3) {
    $composer = $attribute->getValue();
    return $composer;
    break;
    }

    }
    }

    $product is provided in the action as an argument, so you don’t need to use the Integration for this one.
    then you can proceed like above ??

    Thread Starter koolkatwebdesigns

    (@koolkatwebdesigns)

    works! thanks.

    Thread Starter koolkatwebdesigns

    (@koolkatwebdesigns)

    One more question on removing actions…

    How do I remove the action:
    $wp->addAction(‘jigoshop\template\product\before_summary’, array(
    $this,
    ‘productImages’
    ), 10, 1);

    In my theme functions?

    thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Questions’ is closed to new replies.