Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

how can i "get" the current url? Rate Topic   - - - - -

 
  • elk
  • Member
  • Members
  • Join Date: 28-Jan 11
  • 92 posts

Posted 01 March 2011 - 05:12 PM #1

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:
<input name="form_values[24]" type="hidden" class="input-text" id="elm_24" value="XXX" size="50" />

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 <?php ....?> 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?
Mylot.gr // Mobiles & Gadgets
CS-Cart 2.1.3 ver. working fine

 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 02 November 2011 - 12:25 AM #2

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/index.php?dispatch={$seo_url.href}#

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

Any advance? Thanks in advance.
Hire StellarBytes for CS-Cart Design & Development Services

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11322 posts

Posted 02 November 2011 - 12:50 AM #3

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

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 02 November 2011 - 02:02 AM #4

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!
Hire StellarBytes for CS-Cart Design & Development Services

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11322 posts

Posted 02 November 2011 - 05:16 AM #5

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.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 02 November 2011 - 01:30 PM #6

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.

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/index.php?dispatch={$config.current_url}

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
Hire StellarBytes for CS-Cart Design & Development Services

 
  • chirag
  • Member
  • Trial users
  • Join Date: 03-Nov 12
  • 16 posts

Posted 09 January 2013 - 12:15 PM #7

Hello all,

Need Urgent Help..!!!

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...

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1247 posts

Posted 09 January 2013 - 12:38 PM #8

{$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,

 
  • chirag
  • Member
  • Trial users
  • Join Date: 03-Nov 12
  • 16 posts

Posted 10 January 2013 - 07:13 AM #9

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:

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1247 posts

Posted 10 January 2013 - 07:27 AM #10

What version of cs-cart are you using?

$controller = index #Home Page
$controller = checkout & $mode = cart #Cart Page
$controller = products & $mode = search #Search Page

 
  • chirag
  • Member
  • Trial users
  • Join Date: 03-Nov 12
  • 16 posts

Posted 01 February 2013 - 06:45 AM #11

hello,

I am using ULTIMATE (multistore) 3.0.4

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11322 posts

Posted 01 February 2013 - 07:23 AM #12

{$current_url}

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • chirag
  • Member
  • Trial users
  • Join Date: 03-Nov 12
  • 16 posts

Posted 04 February 2013 - 05:51 AM #13

:-(

Ohh Again {$current_url}

This condition is not working..

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11322 posts

Posted 04 February 2013 - 05:56 AM #14

My error {$config.current_url}.

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

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Alexder
  • Junior Member
  • Members
  • Join Date: 08-Apr 10
  • 147 posts

Posted 11 November 2013 - 10:26 AM #15

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)

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11322 posts

Posted 11 November 2013 - 07:28 PM #16

{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.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Alexder
  • Junior Member
  • Members
  • Join Date: 08-Apr 10
  • 147 posts

Posted 12 November 2013 - 03:37 AM #17

Can't get it work, displays {Do what you want for other pages} on every page including home page

 
  • fiberit
  • Advanced Member
  • Trial users
  • Join Date: 05-Oct 13
  • 63 posts

Posted 16 July 2019 - 10:39 AM #18

Try this: {$config.current_url|fn_url}

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