chrometweaks.org

iPage registrar hosting with website?

Click Here To View All Answers...


First off, iPage registrar hosting with website? Thanks in advance for any answer. Second question.. Hello,.

I would like to know if somebody have allready made this or can help me to do it..

I think it's not hard to do..

IN catalog/shopping_cart.php.

I would like a tep_image_button or a link width a image instead of the checkbox to delete a product from the shopping cart..

Tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']).

Thanks.

This post has been edited by.

Tangocharly.

: 28 January 2004, 12:59..

Comments (68)

I'm stumped. I'm not so sure what is the answer to that question. I'll do some investigation and get back to you if I bump into an decent answer. You should email the people at iPage as they probably can answer it..

Comment #1

I will test this..

Thanks a lot.

The osc community is a great one !!..

Comment #2

Ok let's go.

For people who need it :.

The following code allow to delete a product width a link (on a image for example) instead of a checkbox..

This file allow too to delete the product when '0' is put in the input quantity..

Thanks to mtimdog, myriadgames and Noobish-n-stuff.

IN includes/application_top.php (replace case update product).

     // customer wants to update the product quantity in their shopping cart.

     case 'update_product' : if (isset($HTTP_GET_VARS['cart_delete']) && $HTTP_GET_VARS['cart_delete']!=''){.

                         $cart->remove($HTTP_GET_VARS['cart_delete']);.

                          } else {.

                        for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {.

                               //if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {.

       /*del if qty=0*/if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array())) || $HTTP_POST_VARS['cart_quantity'][$i] == 0) {.

                                 $cart->remove($HTTP_POST_VARS['products_id'][$i]);.

                               } else {.

                                 if (PHP_VERSION < 4) {.

                                   // if PHP3, make correction for lack of multidimensional array..

                                   reset($HTTP_POST_VARS);.

                                   while (list($key, $value) = each($HTTP_POST_VARS)) {.

                                     if (is_array($value)) {.

                                       while (list($key2, $value2) = each($value)) {.

                                         if (ereg ("(.*)\]\[(.*)", $key2, $var)) {.

                                           $id2[$var[1]][$var[2]] = $value2;.

                                         }.

                                       }.

                                     }.

                                   }.

                                   $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';.

                                 } else {.

                                   $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';.

                                 }.

                                 $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);.

                               }.

                              }.

        }.

                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));.

                             break;.

In shopping_cart.php.

     $action='action=update_product&cart_delete='$products[$i]['id'];.

     echo '<a href="'tep_href_link(FILENAME_SHOPPING_CART, $action)'">'tep_image(DIR_WS_IMAGES'your_image.gif', IMAGE_BUTTON_DELETE)'</a>;.

Instead of tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'])..

Comment #3

Just a little problem..

When I delete a product by the new link the product is deleted from the shopping_cart but the url in the browser after this action is :.

Http://www.domain.com/shopping_cart.php?ca...roduct_id".

Like.

Http://www.domain.co...cart_delete=205.

Is this can make problem..

Have you got a solution ? .

Thanks..

Comment #4

Nobody to help me.

If I change.

This.

                             }.

                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));.

                             break;.

By.

                             }.

                             if (isset($HTTP_GET_VARS['cart_delete']) && $HTTP_GET_VARS['cart_delete']!='') {.

                                tep_redirect(tep_href_link(FILENAME_SHOPPING_CART);.

} else {.

                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));.

}.

                             break;..

Comment #5

It's work but I hope it won't make compatibility problem or error..

Comment #6

Hello,.

I would like to know if somebody have allready made this or can help me to do it..

I think it's not hard to do..

IN catalog/shopping_cart.php.

I would like a tep_image_button or a link width a image instead of the checkbox to delete a product from the shopping cart..

Tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']).

Thanks.

This post has been edited by.

Tangocharly.

: 28 January 2004, 12:59..

Comment #7

Since the form is a POST and not a GET, that will make things harder..

You could do something like.

$action='action=update_product&cart_delete='$products[$i]['id'];.

//make link.

Tep_href_link(FILENAME_SHOPPING_CART, $action);.

Now, in application top on line 325 should be.

Case 'update_product' :.

This is where it gets tricky.  it's looking for the POST array, checking it against product ids that have been POSTed to see if it's a valid id, then removing it..

You could add something at the top before the for loop like this.

If (isset($HTTP_GET_VARS['cart_delete']) && $HTTP_GET_VARS['cart_delete']!=''){.

}else{//do rest.

For ($i=....

}.

Tep_redirect(tep_href.

Break;.

Case.

Or.

Not have the else (your choice).

Inside the if, you'll have to check if the id is in the cart, then remove.

If ($cart->in_cart($HTTP_GET_VARS['cart_delete'])){ $cart->remove($HTTP_GET_VARS['cart_delete'];.

You'd make the button like.

Echo '<a href="'tep_href_link(...)'">'tep_image('image_name.gif')'</a>';..

Comment #8


This question was taken from a support group/message board and re-posted here so others can learn from it.