Page 1 of 1

Shopping Cart - Problem

Posted: Mon Mar 26, 2007 8:43 pm
by crisb
hi there,

just talked to ted in the irc, but we havent found a solution yet.
perhaps one of you guys could take a look at it too.

here is what should be done:
i tried to implement a very simple shopping cart system as you can see here (in a a static html file):
http://herrbuerger.com/cart/shop.php

though it is in german you will see that the cart works.
what i did now is i tried to implement this simple example into cmsms. up to now it still doesnt work.
you can see what happens (or not ;-) ) when you implement the code into cmsms yourself.

here are the files:
http://herrbuerger.com/cart/shop.php.txt
include: http://herrbuerger.com/cart/wfcart.php.txt

i just pasted the code of the form into a new contentpage and created two udt's ( session and cart).
you will see what code i put in there when you take a look at the files.


cheers,
chris

Re: Shopping Cart - Problem

Posted: Tue Mar 27, 2007 5:36 am
by cyberman
Have you tried to put that source inside a tag / plugin like

Code: Select all

function smarty_cms_function_<tag name>($params, &$smarty)
{
<your source>
}

Re: Shopping Cart - Problem

Posted: Wed Mar 28, 2007 3:59 pm
by crisb
ok, it still doesn't work how i want it to.
but the plugin thing was a good idea.

perhaps one of you guys can take a lok at it.
here is the function i wrote:
http://herrbuerger.com/cart/function.sh ... rt.php.txt

you still need the php cart class that can be found in my initial post.
all there is left to do, is write the following into a new content page:

Code: Select all

<form action="index.php" method="post">
    <input type="hidden" value="1" name="id123" />     
     Menge<input type="text" value="1" size="5" name="qty" /><br />
    <input type="submit" name="add" value="In den Warenkorb" />
</form>
{shoppingcart}
he now adds  the product to the cart, but it doen not work properly. the quantity is always wrong.
deleting the item works perfectly.

i would really appreciate some help. because i have to get this working ;-)

EDIT:
ok, tested some more and found some errors.
he now adds the items properly to the cart, but he does not store/save the added items.
means:
everytimt you submit the form, he displays the value that was entered last.

Re: Shopping Cart - Problem

Posted: Wed Mar 28, 2007 5:27 pm
by crisb
found a solution for my problem, but now i have a new one.
the cart works when i uncomment the following lines in the include.php which can be found in the cmsms root directory.

Code: Select all

$dirname = dirname(__FILE__);
require_once($dirname.DIRECTORY_SEPARATOR.'fileloc.php');

$session_key = substr(md5($dirname), 0, 8);

#Setup session with different id and start it
#@session_name('CMSSESSID' . $session_key);
@ini_set('url_rewriter.tags', '');
@ini_set('session.use_trans_sid', 0);
#if(!@session_id()) {
#if(!@session_id() && (isset($_REQUEST[session_name()]) || isset($CMS_ADMIN_PAGE))) 

    #Trans SID sucks also...
    @ini_set('url_rewriter.tags', '');
    @ini_set('session.use_trans_sid', 0);
    #@session_start();
--> now the cart works, but i cannot login into the cmsms admin section.
anyone got a solution to this?

EDIT

GOT IT! ;-)

Re: Shopping Cart - Problem

Posted: Wed Mar 28, 2007 7:43 pm
by petert
crisb wrote: f
--> now the cart works, but i cannot login into the cmsms admin section.
anyone got a solution to this?

EDIT

GOT IT! ;-)
Please tell us what the solution was

Re: Shopping Cart - Problem

Posted: Thu Jun 21, 2007 11:36 am
by tkeil69575
in cmsms 1.08 i had to change to change the following

- don't include the wfcart.php in the function
- don't use session_start() in the function
- and don't use session_name("wfcart") either,

but instead just include wfcart.php in include.php before session_start()

if(!@session_id())
{
    #Trans SID sucks also...
    @ini_set('url_rewriter.tags', '');
    @ini_set('session.use_trans_sid', 0);
    include "wfcart.php";
    @session_start();
}

tina