Posts by tonyastley

    I have worked around this using a very crude bit of jquery inserted into the back end. Basically checks if the inputs within the fields wraps of the sale and trade price are empty when any price is changed, and if they are it inserts the standard price into the field.


    In theory no price field should now be empty. Meaning sales and promotions shouldn't end up with zero priced items (unless you type a zero into the field).


    I'm not a programmer so this is (very) crude, but it works for adding new products, not sure what I can do for you guys with existing shops though:


    Include this in your backend js (https://docs.grabaperch.com/perch/control-panel/customizing/)

    Yes, try <?php perch_pages_title(); ?>,


    PHP
    1. <?php $pageTitle = perch_pages_title(true); ?>
    2. <?php PerchSystem::set_var('pharmacyName', $pageTitle); ?>

    The true part in the brackets stops perch echoing the title onto the page. Then put your variable in where the value normally goes (no need for single quotes).


    https://docs.grabaperch.com/fu…gation/perch-pages-title/


    It's always useful to have the page title available.

    I'm probably not being 100% clear on what I'm trying to achieve. Here's my situation:


    I have a collection of case studies, the case studies template has a content field called "accessories", the user can add items related to that field from the store. The SKUs of the products are stored in the id as an array.


    What I'm trying to do reverse the model and show the case studies on the product page. I have the SKU for the product and I'm trying to filter out the case studies where the SKU is in the accessories id array. Hence show relevant case studies on products pages.


    It's bound to be something simple I'm missing, but I've trawled the documentation and I can't find anything sowing how to filter when the values are stored in an array.

    You can. Have a look at https://docs.grabaperch.com/te…variables-into-templates/


    You set the system variable before you call your template in the php file

    PHP
    1. <?php PerchSystem::set_var('id_name', 'value'); ?>


    Then in your html template that becomes available as:

    Code
    1. <perch:content id="id_name" />

    You don't have to use id_name, it can be anything. eg.

    PHP
    1. <?php PerchSystem::set_var('closest_pharmacy', 'Birmingham'); ?>

    To perform something conditional use a perch:if statement in your html file:

    Code
    1. <perch:if id="closest_pharmacy" value="Birmingham" match="eq"/>
    2. Birmingham is the closest pharmacy.
    3. <perch:if>

    More about perch if can be found here: https://docs.grabaperch.com/templates/conditionals/if/


    Hope this helps.

    That's not working for me? I think the issue is that the accessories id contains an unnamed array. Hence there is no 'slug' for the filter to match to?


    Here is the showall from the case study:


    url_0 /shop/products/domestic/building-flood-protection/anti-flood-airbricks-testsku
    url_category domestic
    url_1 domestic
    url_subCategory building-flood-protection
    url_2 building-flood-protection
    url_product anti-flood-airbricks-testsku
    url_3 anti-flood-airbricks-testsku
    perch_page_path /shop/products
    breadCrumb DomesticBuilding Flood Protection{...}
    pageTitle Anti-Flood Airbricks (Silicone) - Domestic
    brandID 2
    brandImage {...}
    siteRoot https://dev.m3floodtech.loc
    siteName M3 Global Flood Technologies Ltd
    ogImage https://dev.m3floodtech.loc/as…ec-global-logo-1-w768.jpg
    variantList Available options: Terracotta Price:{...}
    _id 1
    title Case Study Title 1
    _title Case Study Title 1
    slug case-study-title
    categories
    Code
    1. Array
    2. ( [0] => 10
    3. )
    _blocks
    Code
    1. Array
    2. ( [0] => Array ( [columns] => oneColumn [alignment] => left [blockHead] => [textBlock] => Array ( [_flang] => html [raw] => This is a test
    3. [processed] => This is a test
    4. )
    5. [_block_type] => textOnly [_block_id] => qaiz14 [_block_index] => 0 )
    6. )
    accessories
    Code
    1. Array
    2. ( [0] => anti-flood-airbricks-testsku [1] => composite-door-2-comp2
    3. )
    _sortvalue 1000
    perch_item_first true
    perch_item_zero_index 0
    perch_item_index 1
    perch_item_rev_index 3
    perch_item_rev_zero_index 2
    perch_item_odd
    perch_item_count 3
    perch_namespace perch:content



    I'm trying to match within the accessories id which appears to be a simple array.

    I have a perch collection, each item in the collection has a field allowing related precast to be associated. This fields content is stored as an array:


    The id of the field is accessories and it contain the following array:

    Code
    1. Array
    2. (
    3. [0] => anti-flood-airbricks-testsku
    4. [1] => composite-door-2-comp2
    5. )

    I need to filter the collections to show case studies only matching items within that accessories array, this doesn't work:


    PHP
    1. <?php
    2. perch_collection('Case Studies', [
    3. 'filter' => 'accessories',
    4. 'match' => 'contains',
    5. 'value' => 'anti-flood-airbricks-testsku',
    6. ]);
    7. ?>

    I'm sure I did this before, but cannot remember where? Can someone help me do this again please?

    Yeah, I'd seen that in the docs - but it doesn't show anything.


    Steps I've undertaken so far:


    1. Added two files to a product using the files tab in the product admin (files.list.post.php).

    2. Order the product through the system

    3. Added the code to the order view


    PHP
    1. <?php
    2. perch_shop_purchased_files();
    3. perch_shop_purchased_files([
    4. 'order' => $orderID,
    5. ]);
    6. perch_shop_order($orderID, [
    7. 'template' => '/shop/orders/order_better.html'
    8. ]);
    9. ?>

    The perch_shop_order shows the order fine, but the files functions do not show anything?


    There are no errors in the debug, and the standard file.html and files_list.html are in the templates folder?


    Could this be because the product ordered is a variant?

    Hello,


    Is it possible for perch:if to check an output value. My use case is checking if a brand within the shop has an image.


    Code
    1. <perch:if id="shop_brand" output="image" match="neq" value=""
    2. Brand Has Image
    3. </perch:if>


    I can probably do this the long way around with PHP but wondered if there is a more elegant way built in?