We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Shop

perch_shop protected:field question...

I'm trying to this in my cart template:

<perch:if id="manual_checkout_promotion">

Do this...

</perch:if>

where manual_checkout_promotion is a field I created in my promotion.html template. It doesn't seem I have access in the cart to check against it.

So I tried to call the cart this way so see if it was there:


$testcart = perch_shop_cart([ 'raw' =>true, 'skip-template' => true, 'return-html' => true ],0); print_r($testcart);

and all the fields for promotions (except the the title of the discount_code) have :protected as part of their name. I see the field I'm trying to check in this section of the array:


[details:protected] => Array ( [promoID] => 5 [promoTitle] => Offline Credit Card [promoDynamicFields] => {"title":"Offline Credit Card","description":{"_flang":"markdown","raw":"Manually Entered Credit Card Purchase","processed":" Manually Entered Credit Card Purchase<\/p>"},"from":"2017-05-20 07:45:00","to":"2028-05-20 07:45:00","active":"1","manual_checkout_promotion":"manual","action":"discount_by_percent","discount_code":"OFFLINECC","amount_percent":"0","amount":{"142":"","_default":""},"trigger_value":{"142":"","_default":""},"max_discount":{"142":"","_default":""},"max_uses":null,"customer_uses":null,"terminating":"0","persistent":"0","priority":null,"apply_to_shipping":"0","shipping_methods":null,"categories":null} [promoFrom] => 2017-05-20 07:45:00 [promoTo] => 2028-05-20 07:45:00 [promoActive] => 1 [promoOrder] => 1 [promoCreated] => 2017-07-04 11:46:24 [promoUpdated] => 2018-09-18 09:43:52 [promoDeleted] => )

Is there a way I can check the value of that field?

Monty Lewis

Monty Lewis 2 points

  • 5 months ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

No, that's not available in the cart template. You'd need to handle it outside of the template and pass the results in as data.

Shoot. I don’t know what that means.