Shopping Cart - Problem

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
crisb

Shopping Cart - Problem

Post 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
cyberman

Re: Shopping Cart - Problem

Post 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>
}
crisb

Re: Shopping Cart - Problem

Post 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.
Last edited by crisb on Wed Mar 28, 2007 4:20 pm, edited 1 time in total.
crisb

Re: Shopping Cart - Problem

Post 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! ;-)
Last edited by crisb on Wed Mar 28, 2007 5:53 pm, edited 1 time in total.
User avatar
petert
Power Poster
Power Poster
Posts: 282
Joined: Wed Feb 09, 2005 9:30 pm

Re: Shopping Cart - Problem

Post 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
Mambo sucks, that's why I am here.
Now they call it Joomla, but it still sucks!

CMSMS rules!
tkeil69575

Re: Shopping Cart - Problem

Post 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
Last edited by tkeil69575 on Thu Jun 21, 2007 1:12 pm, edited 1 time in total.
Locked

Return to “CMSMS Core”