Custom View Parameters - how to read them?
Hi - here's an example link:
From there you can see we have really cool use of the [DFR:customview?name=something&price=10-100] shortcodes.
One thing I would really love to add is a hyperlink from within the custom view which takes the user to similar products. e.g. Our custom view is called 'AddProducts' and if you imagine we had the following:
Then it will show 5 treadmills upwards of 6000. What I would like is the ability from within the view to identify the ?name=treadmill and ?price=6000- parameters. If I could access those, then I would be able to add a hyperlink (we'll make it stylish too like our custom views) which goes like this:
<a href="/fitness-store/search/?name=treadmill&price=6000->View all</a>
If it's not possible, please let me know as I can just give content editors some standard code to create for their DFR shortcodes and then they have to modify the search query in two places is all.
I understand what you want to do but I don't understand where the ?name=treadmill and ?price=6000- parameters are coming from... Are you manually adding those for each post?
Yes - say for example we write a Mountain Bike Buying Guide, then we could have 4 or 5 different types of bikes that we cover in the buying guide and we would insert this [DFR:AddProduct...] shortcode 4 or 5 times.
We intend to add these manually to *most* of our posts to create a nice link right through to the shop from the posts.
And specifically, regarding the ?name=treadmill and ?price=6000- parameters, these were chosen so that we could identify treadmills with TVs. We found it impossible to do this using the text description - e.g. ?name and ?description do not play nicely together in these [DFR:custom views]
Adding the following code to the AddProduct's Product List module should do the trick:
Thanks - that helped a lot. In the end, I ended up using PHP to write the query and I added in a lot more parameters. Here's what I ended up with so far:
$name = rawurlencode($s->request->params->name);
$price = rawurlencode($s->request->params->price);
$word = rawurlencode($s->request->params->word);
$description = rawurlencode($s->request->params->description);
$brand = rawurlencode($s->request->params->brand);
$merchant = rawurlencode($s->request->params->merchant);
$caption = $s->request->params->caption;
And then under the products, before the clearing div:
<div class="productcaption"><?php echo $caption ?></div><div class="moreproductslink">
<a rel="nofollow" href="/fitness-store/search/?name=<?php echo $name.'&price='.$price.'&word='.$word.'&descriptio n='.$description.'&brand='.$brand.'&merchant='.$me rchant; ?>" >View all</a>
Then I've styled those to float left and right - the finished result can be seen here:
Looks great! Thanks for sharing.
|All times are GMT -5. The time now is 01:13 PM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.