Jump to content

[closed] I am at a full stop


Martinus
 Share

Recommended Posts

How shall I explain ...

I display products per child-page (from category or department or seller or vendor or anything else).
I am using a browse.php template file for all. This works great.
My first page is 'all-products' and inside the products I can click a category, department, seller, vendor, etc.
This click, brings me to the child page, using the same template file. So far so good.

The childs parent-page is a problem. It is actually using another template (name, let's say 'parent').
Another template, because I cannot display products where seller='seller': it would need to be seller=child-page-name.
So, all works great for child pages, but not for parent pages.

On the parent pages, let's say 'departments' I need to display the following...

All departments on the website. I used this code:

$depts = $pages->find("parent=/departments/");
foreach($depts as $dept) {
echo $dept->department->title;

Within all departments, the category (where there are products to find). I used this code:

$cats = $pages->find("parent=/products", department=$dept");
foreach($cats as $cat){
echo $cat->category->title;

Display the qty of products to find in this particular category. I used this code:

$qty = $selector->count("parent="products", department=$dept, category=$cat");

 

But it's not working. I am really lost in this. Please, could someone give me a hand in this?

 

 

Edited by Martinus
dropped $dept and count.
Link to comment
Share on other sites

  • Martinus changed the title to I am at a full stop

Hi DaveP, what do you mean by double quote on a line? 

$depts = $pages->find("parent=/departments/");
foreach($depts as $dept) {
echo $dept->title;

$cats = $pages->find("parent=/products/, department=$dept");
foreach($cats as $cat) {
echo $dept->title; $cat->title;

$total = $pages->count("parent=/products/, department=$dept, category=$cat");
echo $total; 
    }
  }
;?>

This is what I have so far.

Link to comment
Share on other sites

  • Martinus changed the title to [closed] I am at a full stop
On 8/25/2022 at 10:40 PM, Martinus said:
$cats = $pages->find("parent=/products", department=$dept");

I take back the 'twice' (apologies), but there are three double quotes (") in the selector quoted above.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...