Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

moving a checkbox


Guest

Recommended Posts

Posted

Good morning,

I have been struggling to redesign the shopping cart page, in particular I cannot seem to move where the checkbox to delete a product shows up or the text box with the quantity. I know there are functions in htmloutput.php that control how the boxes get built, but somehow there is something else in the shopping cart page that controls how they layout.

 

Has anyone moved these? Is there a simple change that I am missing somewhere? Thanks in advance.

Posted

You can make those changes in a stock osc in catalog/shopping_cart.php. Start at line 64 through line 155.

 

Make sure you backup you file first. If you're not sure what to do it is easy to mess up.

Posted

A lot of the html in the shopping cart is not in shopping_cart.php. Look at about line 154 in the shopping cart for the innocent looking line:

new productListingBox($info_box_contents);

 

That evokes a ton of other html called from includes/classes/boxes.php. Specifically a function called

class tableBox

. Get a book on OScommerce, or google this stuff. Once you get a handle on includes/classes/boxes.php and another two files: includes/functions/html_output.php and includes/functions/general.php you'll be able to do some serious design work with OSCommerce. Otherwise you'll just be scratching your head wondering where the heck things are.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Posted

Thanks for the direction. I found my way to the html_output.php file last night and I was able to make some minor changes, but I think I might need to get a book at this point.

 

Anyone have any suggestions for good books on osCommerce??!! Thanks again.

 

A lot of the html in the shopping cart is not in shopping_cart.php. Look at about line 154 in the shopping cart for the innocent looking line:

new productListingBox($info_box_contents);

 

That evokes a ton of other html called from includes/classes/boxes.php. Specifically a function called

class tableBox

. Get a book on OScommerce, or google this stuff. Once you get a handle on includes/classes/boxes.php and another two files: includes/functions/html_output.php and includes/functions/general.php you'll be able to do some serious design work with OSCommerce. Otherwise you'll just be scratching your head wondering where the heck things are.

Posted

Go to Amazon and search for 'oscommerce'. There are several there might be good. I haven't read any of them, but I wish I had taken my own advice a few years ago when I started with OSCommerce and had gotten a couple at that time. OSCommerce is just frustrating to find stuff in, actually that's not unusual for shopping carts, but it seems it would be a real time saver to have a guide or a book. The Oscommerce site also has a good resource here: http://www.oscommerce.info/ at the knowledge base.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Posted

A lot of the html in the shopping cart is not in shopping_cart.php. Look at about line 154 in the shopping cart for the innocent looking line:

new productListingBox($info_box_contents);

 

That evokes a ton of other html called from includes/classes/boxes.php. Specifically a function called

class tableBox

. Get a book on OScommerce, or google this stuff. Once you get a handle on includes/classes/boxes.php and another two files: includes/functions/html_output.php and includes/functions/general.php you'll be able to do some serious design work with OSCommerce. Otherwise you'll just be scratching your head wondering where the heck things are.

Why are you taking him to includes/classes/boxes.php? Unless I misunderstood the question, the question was how to move the checkboxto delete and the quantity box.

 

The boxes.php file will just change the style of the tables. To change the placement of the above mentioned you need to do that in catalog/shopping_cart.php.

Posted

You are partly correct, at least from what I can make of all the pages mentioned above. Specifically with shopping_cart.php, you can move the code that creates the checkbox, but it doesn't move on the display. Some of the code to create the box, and how it lays out, is controled in html_output. At least from what I can see of it; obviously, if I knew that for sure I wouldn't be asking!

 

Why are you taking him to includes/classes/boxes.php? Unless I misunderstood the question, the question was how to move the checkboxto delete and the quantity box.

 

The boxes.php file will just change the style of the tables. To change the placement of the above mentioned you need to do that in catalog/shopping_cart.php.

Posted

If you are into radical surgery, here is neat contribution that has stripped the info_boxes of all <table> tags, and consequently the table box class in includes/classes/boxes.php . One of the info_box also displays the shopping cart. Look at this contribution:

 

http://addons.oscommerce.com/info/6378

 

The author has completely stripped away the tables, and the table class function, from the info_boxes, and inclosed what's left in a single pair <div> tags. Even if you don't use the contribution, you can much more clearly see the function of the various boxes, and where the forms and checkboxes are. No sorting through endless lines of code filled with nested <table> tags.

 

I use the contribution on my site and love being free of the 'box' , box class that is. Visit http://www. niora.com , add an item to a cart and watch the shopping_cart box pop up.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Posted

You are partly correct, at least from what I can make of all the pages mentioned above. Specifically with shopping_cart.php, you can move the code that creates the checkbox, but it doesn't move on the display. Some of the code to create the box, and how it lays out, is controled in html_output. At least from what I can see of it; obviously, if I knew that for sure I wouldn't be asking!

There is no reason to touch html_output.php or boxes.php. unless you want a lot of work there is no reason to use the contrib listed above.

 

Where are you trying to put things?

Posted

I agree that there is little reason to mess around with the functions in html_output or boxes.php, and lots of good reasons to leave them alone. However, it really helps to understand OSCommerce to grasp what those functions are doing, how it effects the html, etc.

 

However, there are lots of good reasons to decouple the info_boxes the tablebox class.

1) It makes design far easier. (

2) It removes a ton of code from the boxes

3) You can put the info_boxes wherever your little heart desires with out breaking a table structure.

 

On the other hand, decoupling the info_boxes from the tablebox class means you are going to have to come up with another way to keep the design of the info_boxes on your site consistent. (Can you say 'CSS'?)

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Posted

I agree that there is little reason to mess around with the functions in html_output or boxes.php, and lots of good reasons to leave them alone. However, it really helps to understand OSCommerce to grasp what those functions are doing, how it effects the html, etc.

 

However, there are lots of good reasons to decouple the info_boxes the tablebox class.

1) It makes design far easier. (

2) It removes a ton of code from the boxes

3) You can put the info_boxes wherever your little heart desires with out breaking a table structure.

 

On the other hand, decoupling the info_boxes from the tablebox class means you are going to have to come up with another way to keep the design of the info_boxes on your site consistent. (Can you say 'CSS'?)

I agree removing the tables, accept for data output, would make for a cleaner, faster and easier design hence osc 3. Howerver the original question was how to move parts inside the table. When someone is having problems with that, no disrespect osc is a beast, do you really want to take him to redesigning the whole beast? Baby steps.

Posted

My shopping cart page is still pretty basic, though I have done a lot to other parts of the site as far as design and layout. The check box to delete the item is in the upper left;moving to the right I have the image of the product, some description next to that, then the quantity text box and finally the price.

 

I would like both the delete box and the quantity box to appear below the description. Hopefully that makes sense, I know it can be difficult to visualize this stuff.

 

And thanks so far for everyones input.

 

There is no reason to touch html_output.php or boxes.php. unless you want a lot of work there is no reason to use the contrib listed above.

 

Where are you trying to put things?

Posted

Well I'm not sure this what you are looking for so backup your file first.

In catalog/shopping_cart.php find

   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_REMOVE);

Change to

/*
   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_REMOVE);
   */

Find

   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_QUANTITY);

Change to

   /*
   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_QUANTITY);
   */

Find

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

Change to

     /*
     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));
     */

Find

     $products_name .= '    </td>' .

Right above that add

     $products_name .= '<br>' . TABLE_HEADING_REMOVE . ' ' . tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']) . '<br>' . TABLE_HEADING_QUANTITY . ' ' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']);

Find

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

Change to

     /*
     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));
     */

Posted

Thanks for the direction. I will try that tonight and let you know how it goes.

 

Well I'm not sure this what you are looking for so backup your file first.

In catalog/shopping_cart.php find

   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_REMOVE);

Change to

/*
   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_REMOVE);
   */

Find

   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_QUANTITY);

Change to

   /*
   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_QUANTITY);
   */

Find

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

Change to

     /*
     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));
     */

Find

     $products_name .= '    </td>' .

Right above that add

     $products_name .= '<br>' . TABLE_HEADING_REMOVE . ' ' . tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']) . '<br>' . TABLE_HEADING_QUANTITY . ' ' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']);

Find

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

Change to

     /*
     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));
     */

Posted

That was it, thanks. I will take a look at this a bit more when I have some time, so I can better understand what is going on. I am not new to code, but newer to php so I am still struggling with the syntax of it a bit.

 

Thanks again for the help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...