X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   X-Cart 4 (https://forum.x-cart.com/showthread.php?t=72112)

Blainevk 05-16-2015 03:13 PM

X-Cart 4
 
Sorry there is no category for X-Cart 4 so I had to ask this here.

I want to create a page that ONLY displays the Registration form.... NOTHING ELSE.

Does anyone know how to do this?

Version: 4.6.6

totaltec 05-17-2015 06:57 AM

Re: X-Cart 4
 
Blaine,
You are right! We no longer seem to have a forum for this, but it is just because of the new forums for X-Cart 5. Previously all the forums were dedicated to X-Cart classic (4 and below), so now that we have dedicated X-Cart 5 forums it is confusing. I think we need to rename the X-Cart Classic forums to reflect that.

The proper categories are these:
For X-Cart Classic logic questions: http://forum.x-cart.com/forumdisplay.php?f=20

For X-Cart Classic design questions: http://forum.x-cart.com/forumdisplay.php?f=51

Your question would fall into more of the logic category, but it really would be suitable in either. Lets let a mod with more power than I move the thread.

To answer your question, you can easily create a new page:
Create a new php file in the root of X-Cart named whatever you like, myregform.php. At a minimum it needs this code:

Code:

<?php

require './auth.php';

include $xcart_dir.'/include/common.php';

$location[] = array(func_get_langvar_by_name('lbl_my_reg_form'), '');

$smarty->assign('main', 'my_reg_form');

// Assign the current location line
$smarty->assign('location', $location);

func_display('customer/home.tpl',$smarty);
?>


The last bit decides what template you want to display, and above it says "customer/home.tpl". You can build a new template, and put anything you want in there. Of course this is just the start of your project.

You may find that you can simply define "main" like above, and take action based on that in the necessary templates to not display the pieces that you want.

Blainevk 05-17-2015 12:04 PM

Re: X-Cart 4
 
Thanks for the reply totaltec,

The Form is NOT showing up?

Here is the URL of the page I created: http://isexypartynetwork.net/isexyredpoints/giftcatalog/myregform.php

And here is the HTML:

==================

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>iSexy Party Network Registration</title>

</head>

<body>


<?php

require './auth.php';

include $xcart_dir.'/include/common.php';

$location[] = array(func_get_langvar_by_name('lbl_my_reg_form'), '');

$smarty->assign('main', 'my_reg_form');

// Assign the current location line
$smarty->assign('location', $location);

func_display('customer/home.tpl',$smarty);
?>


</body>
</html>

======================

What am I missing?

totaltec 05-17-2015 12:22 PM

Re: X-Cart 4
 
Quote:

Originally Posted by Blainevk
Thanks for the reply totaltec,

The Form is NOT showing up?

What am I missing?

Pretty much the whole boat. :)

The php I provided above is intended to be in the root of your xcart installation just as it is. No HTML should be in the PHP file. That will be included by a template.

Looks like your code so far is working. Like I said above I just gave you the code required to start your own page, the very beginning of the journey.

TBH, it is such a huge undertaking if you are unfamiliar with X-Cart and Smarty than it is ill advised for you to take this project on.

If you are determined, then the next step would be rendering your own template. create a new file in your skin directory, or even in common_files if you must. Put it in the skin/yourskin/customer/ directory and name it myregform.tpl

Put this in it:
Code:

<?xml version="1.0" encoding="{$default_charset|default:"utf-8"}"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{config_load file="$skin_config"}
<html xmlns="http://www.w3.org/1999/xhtml"{if $active_modules.Socialize} xmlns:g="http://base.google.com/ns/1.0" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://ogp.me/ns/fb#"{/if}>
<head>
  {include file="customer/service_head.tpl"}
</head>
<body{if $body_onload ne ''} onload="javascript: {$body_onload}"{/if}{if $container_classes} class="{foreach from=$container_classes item=c}{$c} {/foreach}"{/if}>
  <div>
    <h1>Hello World</h1>
  </div>
{load_defer_code type="css"}
{include file="customer/service_body_js.tpl"}
{load_defer_code type="js"}
</body>
</html>


Now change your php code to use that template.
change this line:
Code:

func_display('customer/home.tpl',$smarty);
to:
Code:

func_display('customer/myregform.tpl',$smarty);

Keep in mind I am just typing up and copy/pasting these examples, not testing them.

totaltec 05-17-2015 12:25 PM

Re: X-Cart 4
 
I'm curious now. Let's see if the above works for you.
You should get a fairly blank page with the words "Hello World".
Then we can work on displaying the form.


All times are GMT -8. The time now is 09:11 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.