Page 2 of 2

Re: About to get fired over this

Posted: Fri Oct 08, 2010 4:12 pm
by lostinthecode
It is included in another file, there are about 6 files that work together to make this shopping cart work

Re: About to get fired over this

Posted: Fri Oct 08, 2010 4:19 pm
by John Cartwright
Try placing var_dumps() and exit() around the script to determine where the values aren't persisting, but really, that spaghetti soup is insanity.

So I guess I'll leave it at good luck.

P.S., I'm sure if you offered someone like $100 they would probably debug it for you.
P.S.S, any boss that puts pressure on you like that to debug a really nasty legacy script in just a few hours, I would laugh at him. Try to explain to him the cost of bringing in and training someone new, to only experience the same issues as you, will likely far outweigh the additional hours you'd require to complete the task.

Re: About to get fired over this

Posted: Fri Oct 08, 2010 4:22 pm
by Obadiah
post them bro....with all of us here we should be able to pinpoint the error your having...post all of em if you have to ....make sure to edit out the database connection info

Code: Select all

$conn = mysql_connect("********","*****","**********") or die(mysql_error());

Re: About to get fired over this

Posted: Fri Oct 08, 2010 5:10 pm
by Benjamin
E_ALL doesn't mean the errors will be displayed. You also need to turn display_errors on. As I said, check the error log.

Re: About to get fired over this

Posted: Fri Oct 08, 2010 6:00 pm
by diseman
I'm a PHP noob, but you sure you have the right database name in your shopping cart program? HostGator has a two part naming system for databases such as in your case:

agencyequipment_shopping cart

or maybe something like

agencyequipment_SomeNameHere

surely not much of an answer, but just trying to help.

best of luck to you

Re: About to get fired over this

Posted: Mon Oct 11, 2010 4:39 pm
by twinedev
No more updates... Does that mean the boss was serious and the job is over?

Re: About to get fired over this

Posted: Thu Oct 14, 2010 8:40 am
by lostinthecode
Sorry I've been sick the past few days, actually the job is still here. My boss decided he wanted to move to godaddy for hosting so I had to help with that and magically the cart started working again. I do have one more problem though and it's really not that hard of a fix, but I can't figure it out.

Code: Select all

        </fieldset>
        <?php } ?>

        <div>
            <input type="checkbox" name="customer_agreed" id="customer_agreed"> I understand and agree to the <a href="/terms/">terms and conditions</a>  of this sale.<br><br>
            <input type="submit" name="customer_order_new" id="customer_order_new" value="Submit Order">
        </div>
    </form>

    <?php
}
That is just a snippet of the previous code I posted, I was wondering if there is a way to make the 'submit' button send an email instead of going to the authorization page, I'm sorry if I needed to start a new post for this, thanks for all your help guys.

Re: About to get fired over this

Posted: Thu Oct 14, 2010 8:57 am
by diseman
I suspect you would have to change the:

Code: Select all

name="customer_order_new"
Do you have some IF statement that is looking for "customer_order_new" ? Something like:

Code: Select all

if ($_POST['customer_order_new'])
You could either change the existing IF code or rename the 'name=' and then add your new code that sends an e-mail instead.

Please remember I'm new to PHP programming, so my two cents is only worth one cent. : )

Good luck and I'm glad you kept your job..

Re: About to get fired over this

Posted: Thu Oct 14, 2010 10:54 am
by lostinthecode
So basically I need to redefine customer_order_new with code that would send the email instead of sending it to the credit card processing? I am extremely new to eCommerce especially using php so I want to make sure that everything is on the up and up before we start promoting the site. I know of a few ways to code a mailing function, but can anyone help me with which is the most efficient or secure?

Here is the code snippet where customer_order_new is called:

Code: Select all

    }
            $cart->saveCart();
            if (count($cart->cart_items) > 0) {
                $cart->loadItemInfo();
                displayCheckoutForm($_POST);
            } else {
                unset($cart);
                header("Location: /");
            }
        } elseif ((array_key_exists("customer_order_new", $_POST)) && (! empty($_POST["customer_order_new"]))) {
            if ((! array_key_exists("customer_agreed", $_POST)) || (strcmp($_POST["customer_agreed"], "on"))) {
                echo "<p>You must first agree to the terms and conditions governing the use of this website.</p>\n";
                displayCheckoutForm($_POST);
            } else {
                $custid = 0;
                if (! $user->isAuthenticated()) {
                    if (! empty($_POST["customer_pass1"])) {
                        if (($cid = $customers->Create($_POST))) {
                            $custid = $cid;
                        } else {
                            echo "<p>" . $_SESSION["msg"] . "</p>\n";
                            unset($_SESSION["msg"]);
                            displayCheckoutForm($_POST);
                        }
                    }
                } else {
                    $customers->Fetch("customer_user = {$user->user_id}");
                    $cust = current($customers->customers);
                    if ($cust) {
                        $custid = $cust->customer_id;
                        if (! $customers->Edit($custid, $_POST)) {
                            echo "<p>" . $_SESSION["msg"] . "</p>\n";
                            unset($_SESSION["msg"]);
                            displayCheckoutForm($_POST);
                        }
                    } else {
                        if (($cid = $customers->Create($_POST))) {
                            $custid = $cid;
                        } else {
                            echo "<p>" . $_SESSION["msg"] . "</p>\n";
                            unset($_SESSION["msg"]);
                            displayCheckoutForm($_POST);

Re: About to get fired over this

Posted: Thu Oct 14, 2010 11:12 am
by diseman
I personally wouldn't change anything in that code. Instead - change the ' name= ' to something like:

Code: Select all

<input type="submit" name="customer_order_new_test" id="customer_order_new" value="Submit Order">
Then you could do (be sure to expand my example) something like:

Code: Select all


if ($_POST['customer_order_new_test'])

    {

       send your e-mail code here...

   }

Obviously when you got it to work like you want you could change the _test to something more appropriate.

This way you don't mess with any pre-existing code in case you have to go back to it.

Also, you really never said what you wanted the e-mail to do or even why an e-mail at that particular point. I have some e-mail code I could share with you, but really need to know what you're trying to e-mail, so I know if what I have can help you.

Explain the e-mail for us. What are you emailing? Just text or are there attachments? is the email dynamic (i.e. pulling data from db)

Re: About to get fired over this

Posted: Thu Oct 14, 2010 11:35 am
by lostinthecode
Basically instead of submitting the order form it would send the order to an email address for verification and then we would do the credit card authorization in-house as we do not have any kind of online merchant services and we only cater to military and law enforcement customers so we need to be able to review the order and make sure they are who they say they are before we actually process. I hope this explains what I am trying to do with this code. Thanks again guys, this is one of the most helpful forums that I have ever posted on.

Re: About to get fired over this

Posted: Thu Oct 14, 2010 11:39 am
by Jonah Bron
lostinthecode wrote:Thanks again guys, this is one of the most helpful forums that I have ever posted on.
Can I put that in our testimonials? :lol:

Re: About to get fired over this

Posted: Thu Oct 14, 2010 11:42 am
by lostinthecode
haha... If you would like to I would be more than happy to be a spokesperson :lol: I am slowly starting to get more comfortable with php and would love to become a helpful addition to this forum.