Dynamically Loading Products in CoreCommerce
Permalink
I have an idea, and as far as I can tell, it's not possible out of the box with the e-commerce package, but I wanted to ask first to make sure I wasn't missing anything. Here's what I'd like to do:
Rather than having to have an individual page for each product, it would be nice to have a single "Product Detail" page with an instance of the Product block on that page. The page would load a product based on a "pID" parameter from the URL. I know this isn't quite as SEO friendly as having individual pages, but I'm thinking it will be easier to manage for a particular site I'm doing.
I've already tweaked the product block to allow for this. However, it would require some tweaking of the product list as well - specifically, rather than linking to that product's page, it would need to link to site.com/product-page?pID=X, where X = the product's ID.
Any thoughts?
Rather than having to have an individual page for each product, it would be nice to have a single "Product Detail" page with an instance of the Product block on that page. The page would load a product based on a "pID" parameter from the URL. I know this isn't quite as SEO friendly as having individual pages, but I'm thinking it will be easier to manage for a particular site I'm doing.
I've already tweaked the product block to allow for this. However, it would require some tweaking of the product list as well - specifically, rather than linking to that product's page, it would need to link to site.com/product-page?pID=X, where X = the product's ID.
Any thoughts?
Yeah, that's essentially what I've got. I just wanted to make sure that there wasn't something built in that I was missing.
Just wondering - does anyone else like it this way, or is it just me? Meaning - I prefer to have a single "Product Detail" page, and just load the product dynamically via the URL. Outside of SEO, is there a good reason to have individual pages for each product? Anyone have particular preferences/opinions on this?
Just wondering - does anyone else like it this way, or is it just me? Meaning - I prefer to have a single "Product Detail" page, and just load the product dynamically via the URL. Outside of SEO, is there a good reason to have individual pages for each product? Anyone have particular preferences/opinions on this?
Having individual pages for each product allows you to add other blocks to the page like a guestbook, rating, image gallery, etc. You wouln't be able to do that on a single page.
well you could render the associated areas for each product as they are still collections/pages. You can use this singlepage as another view to the product page and just load stuff by the area, so an edit on the product page will be reflected in your catalog page or whatever you want to call it and the collection rendered arg per product, by passing in the page object to the area display/render.
Well technically you could do anything you want, in that case you'd still need to have an individual page associated to each product, you'll just be looking at that page and updating it in a different way. I think the answer to justin's question would be:
You don't really need an individual page for each product unless you want finer control on how each individual product page looks and/or want some custom blocks in the page.
And to add more variables to the discussion, you could turn the product names into fancy URLS and pass that to the single product page. Then parse the URL in the single product page to get the product from there. Just like I did here:
http://www.kiwicostumes.co.nz (note: this is not a eCommerce site, but same idea would work)
You don't really need an individual page for each product unless you want finer control on how each individual product page looks and/or want some custom blocks in the page.
And to add more variables to the discussion, you could turn the product names into fancy URLS and pass that to the single product page. Then parse the URL in the single product page to get the product from there. Just like I did here:
http://www.kiwicostumes.co.nz (note: this is not a eCommerce site, but same idea would work)
Also...
Haven't checked eCommerce in a while, don't know if you can do categories now, but in the initial version, the way you had to mimic categories is to move product pages around in the site map and use the product list block to display products under that page.
As I said, I don't know if that's changed now.
Haven't checked eCommerce in a while, don't know if you can do categories now, but in the initial version, the way you had to mimic categories is to move product pages around in the site map and use the product list block to display products under that page.
As I said, I don't know if that's changed now.
I did categories a little bit different in that I just created a product attribute called "category" as a checkbox. It seemed a little odd to me at first that there wasn't an out-of-the-box way to just do flat-out categories, but I kinda like doing it this way now. Feels very flexible and it's really pretty easy.
Yeah, I don't know what it is specifically, but I just like the idea of having a single product detail page and then loading products dynamically off of that one page. Maybe it's simply the idea that a product is not a page, so why have a page for it if it's not necessary. To me, it just makes things a little more complicated (though I'm sure there's others who prefer the other way).
I like how you did that on kiwicostumes and would like to integrate something like that into c5 commerce - basically parsing the url to get the product.
Right now the trick for me is getting the product listing to link to the product detail page and pass the product ID to it. It's not difficult - I just want to do it in a way that not "hacky" while at the same time modifying the block as little as possible.
I like how you did that on kiwicostumes and would like to integrate something like that into c5 commerce - basically parsing the url to get the product.
Right now the trick for me is getting the product listing to link to the product detail page and pass the product ID to it. It's not difficult - I just want to do it in a way that not "hacky" while at the same time modifying the block as little as possible.
You would basically just load up function on_start(){
$productID = $this->get('productID') etc. on through
}
Then probably a custom model to load based on these parameters. I don't have a copy of corecommerce up right now to check it out so I am not sure how the relations work with all of that, but that is the way I would go about it.
-Scott