how can i "get" the current url?

hi

i made a custom form>copy it > and paste it as an html block in products tab

i use it as “Easy order” form. User click on products tab>fill in his info> click send and i receive the order



My only problem is that i can’t grab the current page url or seo or product name or product code and set it as a hidden field.



the field i want to change is:

[HTML][/HTML]

where XXX should be the product’s code or name or seo

i use the below vars with no success. it just doesn’t read the var.

{$current_url}

{$seo_url.href}

{$seo_url.page}

{$current_url}

{$controller}

{$lnk}

{if $send_data.notes}{$send_data.notes}{else}{$product.product|unescape}

{$product.product|unescape}

{$product.product_code}



i also tried to use but still nothing. i also grab the whole code from send_to_friend.PHP and put it at the top of my form, but still nothing



any help please?

Did you ever work this out? I am trying to create a Content Link to appear as a subcategory with categories within in a menu. I do not want this subcategory to have a page, therefore the link structure should be something like:



Services:

-BMW (.com/bmw.html)

-Audi (.com/audi.html)

  • Maintenance.com/(THECURRENTPAGEURL)#

    – Brakes (.com/brakes.html)

    – Wheels (.com/wheels.html)

    – Clutch (.com/clutch.html)



    I am trying to get the current URL into this link, therefore when it is clicked, the browser will use the href # function and so, the link will actually be to a null page, thus producing domain.com/current-page-url.html#.



    I have tried: {$seo_url.href}/# but this produces Domain.com



    This can be clicked on but leads to a 404 error page.



    Any advance? Thanks in advance.

It would be {$config.current_url}, not {$current_url}

Thanks - close, but no cigar.



Now I get the following link:

domain.com/index.php?dispatch={$config.current_url}

This one's driving me nuts!

The {$config.current_url} contains the current URL for the given protocol (http or https). I'm sorry, but I can't help you here any further. I've given pointers and aside from me doing the research and work for you, you'll have to figure it out on your own unless someone else here on the forum wants to chime in.

[quote name='tbirnseth' timestamp='1320210973' post='125146']

The {$config.current_url} contains the current URL for the given protocol (http or https). I'm sorry, but I can't help you here any further. I've given pointers and aside from me doing the research and work for you, you'll have to figure it out on your own unless someone else here on the forum wants to chime in.

[/quote]

Thank you for your assistance nonetheless, it is appreciated.



The strange thing about using “{$config.current_url}” as the Page URL, is it creates a URL with structure:



Domain.com



No other variable creates the index.php?dispatch= part of the URL, so it is as if it is half working.



If you can think of a reason why and another step towards a solution, I would appreciate your help - from whoever that may be.



Thank you

Hello all,



[color=#ff0000]Need Urgent Help…!!![/color]



I want static conditions for home page and other pages.

I have one common block in header.

I have one static condition in that block. means, {if homepage} some code {else} some code {/if}



but, i am not able to do this. i have tried many things and searched through forums, but failed to get what i want.



when i use “{$config.current_url}” then i am not able to get current URL of cart page like “index.php?dispatch=checkout.cart” insted of this i got “index.php”. I also face the same problem for search page also.



so, using “{$config.current_url}” i am not able find current controller or URL.



Is there any other way that differentiate the home page and other pages?



Please Help…

{$controller}

{$mode}

{$smarty.const.ACTION}



this are the variables from dispatch



for ex:


{if $smarty.const.ACTION}
{assign var="current_dispatch" value="`$controller`.`$mode`.`$smarty.const.ACTION`"}
{else}
{assign var="current_dispatch" value="`$controller`.`$mode`"}
{/if}
{$current_dispatch}




or if you wish to check if homepage:


{if $controller == 'index'}
{*homepage text*}
{else}
{*nonhomepage text*}
{/if}




I hope that helps,

Hi Vali,



Thanks for your reply.

I have used your conditions. but no success.



All these conditions returns same value for “Home Page” , “Cart Page” , “Search Page” etc.

With this condition i am able to differentiate categories, products page but not able to differentiate “Home Page” , “Cart Page”.



Any One have other trick…!!

:rolleyes: :rolleyes:

What version of cs-cart are you using?



$controller = index [color=#ff0000]#Home Page[/color]

$controller = checkout & $mode = cart [color=#ff0000]#Cart Page[/color]

$controller = products & $mode = search [color=#ff0000]#Search Page[/color]

hello,



I am using ULTIMATE (multistore) 3.0.4

{$current_url}

:-(


Ohh Again {$current_url}

This condition is not working..

My error {$config.current_url}.



You could search the source for 'current_url' and answer this all by yourself you know…

I created “HTML block with smarty support”, is it possible to write condition that on homepage displays one text, on other pages display another text? (V4.0.2)

{if $controller == 'index' && $mode == 'index'}

Do what you want for homepage

{else}

Do what you want for other pages

{/if}



Applies to all versions of cs-cart.

Can't get it work, displays {[color=#282828][font=arial, verdana, tahoma, sans-serif]Do what you want for other pages} on every page including home page[/font][/color]

Try this: {$config.current_url|fn_url}

This get the SEO link and not dispatch.
Works in 4.10.x