View Full Version : conditional redirect to another screen
Barrett
07-27-08, 05:18 PM
I'm working on a redirect to capture invalid products and cats.
Do not know the syntax to call the desired screen at line 6.
<mvt:if expr="NOT ISNULL l.settings:product:code">
<mvt:item name="xprodtemplate" />
<mvt:exit />
<mvt:else>
Sorry, this product is no longer available.
<mvt:item name="THE SRCH SCREEN" />
</mvt:if>
That won't do it. Use the render function in the Emporium Plus Tool Kit.
#31 at http://www.emporiumplus.com/go/wcw/PROD/1AA/1AA00223
With the code you have the customers will never see the product screen. Take out
<mvt:exit />
<mvt:else>
Instead, right AFTER you render the SRCH page, put just
<mvt:exit />
Barrett
07-27-08, 05:54 PM
That won't do it. Use the render function in the Emporium Plus Tool Kit.
#31 at http://www.emporiumplus.com/go/wcw/PROD/1AA/1AA00223
With the code you have the customers will never see the product screen. Take out
<mvt:exit />
<mvt:else>
Instead, right AFTER you render the SRCH page, put just
<mvt:exit />
Tried that a couple ways and what you say returns a blank screen.
This chunk works. It is set up to call Sebenza custom Prod screens and exit if prod exists. Not sure what I'm missing on that.
http://beta.handmade-paper.us/page/CPO/PROD/mmr/05-02-01homer_simpson
http://beta.handmade-paper.us/page/CPO/PROD/mmr/05-02-01
<mvt:if expr="NOT ISNULL l.settings:product:code">
<mvt:item name="xprodtemplate" />
<mvt:exit />
<mvt:else>
Sorry, this product is no longer available or may have been moved. Please use our search below.
<mvt:item name="toolkit" param="export|product_error.dat^|^g.Product_Code,remote_a ddr,http_referer" />
<mvt:item name="toolkit" param="render|SRCH" />
</mvt:if>Now I need to make it work on the Cat screens too.
I didn't see the call to product template, as these code inserts in the forum are microscopic. I wish they would get rid of the smileys so we wouldn't have to use the insert.
Anyway, you should put an <mvt:exit> between these two lines
<mvt:item name="toolkit" param="render|SRCH" />
</mvt:if>
That way it won't try to display the PROD page after it displays the SRCH page.
Like
<mvt:item name="toolkit" param="render|SRCH" />
<mvt:exit>
</mvt:if>
Barrett
07-27-08, 06:22 PM
I did it both ways and seems to work ok.
Is your way more technically correct or something ?
The way I had it at first seemed to make sense to me to exit the code once it knew the first test was true.
I have what you advised now as shown.
<mvt:if expr="NOT ISNULL l.settings:category:code">
<mvt:item name="ctgytemplate" />
<mvt:else>
<span id="error_notfound">Sorry, this category may have been renamed or moved. Please use our search below.</span>
<mvt:item name="toolkit" param="export|category_error.dat^|^g.Category_Code,remote _addr,http_referer" />
<mvt:item name="toolkit" param="render|SRCH" />
<mvt:exit />
</mvt:if>
Test for missing cat http://beta.handmade-paper.us/page/CPO/CTGY/mmr-homer
Test for prod http://beta.handmade-paper.us/page/CPO/PROD/mmr/05-03-01homer
Excellent. However, more important, how did you get that text in the insert larger?
Barrett
07-27-08, 06:38 PM
advanced edit
select all the code text
Size 4
LOL
Can you tell me how we can mod the toolkit string to capture more of or the full error url and the actual referrer url instead of an IP ?
The http_referer is the referring url. You will only see that if they clicked a link from another page, e.g. a search index, to get to your bad page. You should be seeing the full url from the bad link you posted above as people click it.
The IP will be there no matter how they got to the bad page, i.e. clicked a link somewhere or had it bookmarked or manually typed it in.
Barrett
07-27-08, 08:01 PM
I'm only getting
05-02-01homer|76.226.188.13|
for this: http://beta.handmade-paper.us/page/CPO/PROD/mmr/05-02-01homer
mmr|76.226.188.13|
for this http://beta.handmade-paper.us/page/CPO/PROD/mmr
I believe Merchant will not return the url with some server configurations. That said, I believe I am on the same host as you. http_referer works on the server I am on.
Yesterday I posted this link in a thread.
http://www.pinemporium.com/mm5/merchant.mvc?Screen=PROD&Product_Code=ASDF
I just checked my product_error.dat file and it is there as
http://extranet.mivamerchant.com/forums/showthread.php?t=17597
That tells me two things:
1) People actually read this forum
2) The referring url was included in the log
Barrett
07-27-08, 08:41 PM
Finally sunk in what you were saying...
I tried my own links in the post and yes we got that string now, but not the full url that failed out.
05-02-01homer|76.226.188.13|http://extranet.mivamerchant.com/forums/showthread.php?p=77832
mmr|76.226.188.13|http://extranet.mivamerchant.com/forums/showthread.php?p=77832
What do you mean full url? That is the full url of the thread post.
Barrett
07-27-08, 08:52 PM
http://beta.handmade-paper.us/page/CPO/PROD/mtx/02-10-01homerphied|76.226.188.13|http://extranet.mivamerchant.com/forums/showthread.php?p=77832
not this
/02-10-01homerphied|76.226.188.13|http://extranet.mivamerchant.com/forums/showthread.php?p=77832
You don't need the full url. You already know it. The bad product code entry would not have been in the log if the http://beta.handmade-paper.us/page/CPO/PROD/mtx/ had not been the first part of the url they tried. Anything else would have taken them somewhere else which would not have had the tool kit export function on it.
The example is for trapping bad product codes. You probably could use something like s.documenturl instead of product_code.
Barrett
07-27-08, 09:06 PM
Well in most cases you are right, but if someone enters a partial url on purpose or by accident or some other inbound link has a random typo it will not capture it like this
http://beta.handmade-paper.us/page/CPO/PROD/mtx/
or
http://beta.handmade-paper.us/page/CPO/PROD/mtx
Thosse are a couple random examples I did myself by accident and will get a regular 404.
So in those cases we need to figure out how we can log the 404's too that are not recognized by the miva engine side.
That is because you aren't using real merchant urls. It has to run merchant before you will have a chance to trap the error in merchant. That is true of the old MM4 modules too.
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.