Skip Navigation

[Resolved] Filter of view for brothers makes the custom field repeat the current page

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 8 replies, has 2 voices.

Last updated by Waqar 8 months, 2 weeks ago.

Assisted by: Waqar.

Author
Posts
#2689982

I am building a site which uses pages, and sub pages, the subpages are products (but they are just pages, with a custom field for "price").

However when I create a view to show brother products, the page name and thumbnail image work fine, however the "price" in the view is the same as the current page, rather than the price field of each page in the loop.

I appreciate I can create a custom post type to manage this, but there are reasons why I need to do it via pages.

If i take the filter off so it's displaying all records, the price field displays correctly, but if I add a filter into the view, the price field uses the current page.

i have tried doing the view using blocks, and doing it the legacy way,I've also followed your tutorial on creating the brother pages here: https://toolset.com/documentation/legacy-features/views-plugin/displaying-brother-pages/ but it still doesn't work.

in simple terms my view looks like the below, and whether I filter byt page parent, or by a taxomony/category the results are the same.

<wpv-loop>
<p>[wpv-post-title]</p>
<p>[wpv-post-featured-image]</p>
<p> [types field='price'][/types]</p>
</wpv-loop>

is there a way to reset the loop items at the start of the view so it forgets about the current page? or is there any other way around this?

Regards,
Vince

#2690021

Hi Vince,

Thank you for contacting us and I'd be happy to assist.

It is unusual, that the price custom field's value is being picked up from a different page/post from the one in the current loop.

To troubleshoot this, I'll need to see how these pages, custom field, and the view are set up in the admin area. Can you please share temporary admin login details along with the link to the page with this view?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2690694

Thank you for sharing the access details.

I've checked the example page that you've shared ( {yourwebsite.com}/hottubs2023/hot-tubs/jacuzzi/jacuzzi-j-200/jacuzzi-j-225-hot-tub/ ) and these are the pages that are showing through the view:

{yourwebsite.com}/hottubs2023/hot-tubs/jacuzzi/jacuzzi-j-200/jacuzzi-j-235-hot-tub/
{yourwebsite.com}/hottubs2023/hot-tubs/jacuzzi/jacuzzi-j-200/jacuzzi-j-245-hot-tub/
{yourwebsite.com}/hottubs2023/hot-tubs/jacuzzi/jacuzzi-j-200/jacuzzi-j-275-hot-tub/
{yourwebsite.com}/hottubs2023/hot-tubs/jacuzzi/jacuzzi-j-200/jacuzzi-j-285-hot-tub/

The price for all of them is showing as '£9,999.00' and that is because, if you'll check the edit screen of all these brother pages, in the 'Price' custom field you'll see the same value.
( example screenshot from the edit screen of 'Jacuzzi® J-235 Hot Tub': hidden link )

Even though in the content a different price value is being shown, the view will pick up the custom field value and not the one set in the content part.
( content screenshot from the edit screenshot of 'Jacuzzi® J-235 Hot Tub': hidden link )

Important note: Because the price field values and the rest of the content are being repeated in the content part of all these pages, the actual custom field values can be affected if the value of one of them is changed/updated.

The safe and recommended approach would be to create a content template for these pages so that they can show common content through that and any dynamic/changing values through the respective custom fields.
( ref: https://toolset.com/lesson-placement/lesson-placements-1621067-1621091/ )

#2690778

Hi Waqar,

Strangely, prior to sending you over access, I went through all of those pages j200 and updated the pricing in those fields to reflect the actual prices, however they are all now set at £9,999 which was the last price I updated.

So in actual fact I think you have stumbled onto the actual issue just by pointing out to me al the prices are the same, if I change that field value (Which is a toolset custom field) on one page, it updates that field value on all other pages.

I looked into it, and I had the field set in toolset to "This field can have only one value".

Thank you very much for looking, I wouldn't have spotted it without your prompt.

I'm going to see if that fixes the issue.

#2690780

No it doesn't work.

So the actual issue is that additonal field I added in as a single line field called price. When I update it on the page, it also updates this field across all pages to be the same value.

Why is it doing this?

#2691127

Thanks for the update and glad that we were able to narrow down the issue.

I'm afraid, I don't have the exact reason to share yet, for why updating the 'price' field in one of the pages updates it for all of them. During testing on my website with similar settings, I couldn't reproduce the behavior.

This suggests that something specific to your website is involved. Do I have your permission to download a clone/snapshot of your website to investigate this on a different server? This will allow me to get the bottom of it, without affecting the actual website.

#2691309

Yes that is fine to do. I did install ACF and that is working fine with no problems. However I would prefer to just use the toolset to manage everything instead.

#2691499

Thank you for the permission and I've downloaded the website's clone.

I'll be running some tests on this clone and will share the findings, as soon as this testing completes.

#2692091

Thank you for waiting, while I completed this troubleshooting.

During testing on a couple of different test environments, I was not able to reproduce this issue of custom field values becoming updated from multiple posts coming from a post view in the content.

On your website's clone, I deleted the existing view 'Jacuzzi j200 range full', from the content of the page 'Jacuzzi® J-225 Hot Tub' and inserted a new view in its place with the same settings and called the same content template ( 'Product Listing' ) in the loop and the issue was no longer reproducible either.

Here are my recommendations moving forward:

1. When you create a new view in the content of this page, be sure to keep the 'Cache View' option disabled from the view's settings.

2. In the "LiteSpeed Cache" plugin's cache settings, keep the 'Cache REST API' option, disabled.

I hope these recommendations will help and let me know if you have any follow-up questions.