Jump to content

drunknbass

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

drunknbass's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=372537:date=May 9 2006, 02:12 AM:name=Steady_Eddie)--][div class=\'quotetop\']QUOTE(Steady_Eddie @ May 9 2006, 02:12 AM) [snapback]372537[/snapback][/div][div class=\'quotemain\'][!--quotec--] i can see whats happening on the site but we need to be able to see the code setion that your taling about. i can only view the html source not the php. [/quote] i uploaded it as a txt. for some reson i cant post it in this thread it keeps going to an error index page on this site. i think im going crosseyed ive been starring at my screen looking for }'s for hours. look in my first post for the txt file.
  2. k im developing an oscommerce site, and most people on thier dont really get into hacking up the code and are mostly new to php and follow the cookie cutter sites, so im posting here :P i am ging nuts on this last page i cant get to work right. basically ..... theres a } in the wrong place, i moved it on accident a long time back in the coding phase and im lost nw. bsically if there are no attributes the page stops displaying data after the name and desc. like this [a href=\"http://www.enveamerica.com/product_info.php?cPath=135&products_id=77\" target=\"_blank\"]http://www.enveamerica.com/product_info.ph...&products_id=77[/a] with attributes [a href=\"http://www.enveamerica.com/product_info.php?cPath=135&products_id=79\" target=\"_blank\"]http://www.enveamerica.com/product_info.ph...&products_id=79[/a] and if thier are attributes itll display everything.. so i think cause the } being n the wrong place some important stuff like add to cart , price, etc are getting stuck in the IF statement that checks if there are variables for attributes. normally it wouldnt be that hard but every logical place i put the } either destroys the page structure or doesnt have the right effect. i HAD it working but by accident i went to a product that was unavalable and it destroyed the structure. thats how i stumbled accross the mixup. so this page needs to display correct also (random invalid product id) [a href=\"http://www.enveamerica.com/product_info.php?cPath=135&products_id=7656464\" target=\"_blank\"]http://www.enveamerica.com/product_info.ph...ucts_id=7656464[/a] PLEASE PLEASE PLEASEEEEE SOMEONE WITH GOOD EYES HELP ME, ILL HOOK YOU UP WITH A PRODUCT! for some reason it wont let me quote the code so heres a txt file with it [a href=\"http://www.enveamerica.com/code.txt\" target=\"_blank\"]http://www.enveamerica.com/code.txt[/a]
  3. yea thats pretty simple. i thougt i had to add the explode implode int he query itself like the code i posted.. that should work alot easier. thanks.
  4. [!--quoteo(post=371786:date=May 6 2006, 01:28 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ May 6 2006, 01:28 AM) [snapback]371786[/snapback][/div][div class=\'quotemain\'][!--quotec--] See [a href=\"http://www.php.net/explode\" target=\"_blank\"]http://www.php.net/explode[/a] [a href=\"http://www.php.net/join\" target=\"_blank\"]http://www.php.net/join[/a] [/quote] awesome.. i got it to pull data and format it now.. but now im having a hard time with the implode fuction. i have to add it to the sql query when it reads and writes to the database and im having a hard time.. i have the xcart code where every line has the implode in the query like this. [code] db_query("DELETE FROM $sql_tbl[class_options] WHERE optionid IN ('".implode("','", array_keys($to_delete))."')"); [/code] but i do not know how to incorperate it into my queries. incase someone wants to help here is my current code id like the functionaly of the implode [code] <?php /*   $Id: product_extra_field.php,v 2.0 2004/11/09 22:50:52 ChBu Exp $   osCommerce, Open Source E-Commerce Solutions   http://www.oscommerce.com   Copyright (c) 2003 osCommerce   Released under the GNU General Public License   *   * v2.0: added languages support */ require('includes/application_top.php'); $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); // Has "Remove" button been pressed? if (isset($HTTP_POST_VARS['remove_x']) || isset($HTTP_POST_VARS['remove_y'])) $action='remove'; if (tep_not_null($action)) {   switch ($action) {     case 'setflag':       $sql_data_array = array('products_extra_fields_status' => tep_db_prepare_input($HTTP_GET_VARS['flag']));       tep_db_perform(TABLE_PRODUCTS_EXTRA_FIELDS, $sql_data_array, 'update', 'products_extra_fields_id=' . $HTTP_GET_VARS['id']);       tep_redirect(tep_href_link(FILENAME_PRODUCTS_EXTRA_FIELDS));           break;     case 'add':       $sql_data_array = array('products_extra_fields_name' => tep_db_prepare_input($HTTP_POST_VARS['field']['name']),                               'languages_id' => tep_db_prepare_input ($HTTP_POST_VARS['field']['language']),                               'products_extra_fields_order' => tep_db_prepare_input($HTTP_POST_VARS['field']['order']));             tep_db_perform(TABLE_PRODUCTS_EXTRA_FIELDS, $sql_data_array, 'insert');       tep_redirect(tep_href_link(FILENAME_PRODUCTS_EXTRA_FIELDS));       break;     case 'update':       foreach ($HTTP_POST_VARS['field'] as $key=>$val) {         $sql_data_array = array('products_extra_fields_name' => tep_db_prepare_input($val['name']),                                 'languages_id' =>  tep_db_prepare_input($val['language']),                                    'products_extra_fields_order' => tep_db_prepare_input($val['order']));               tep_db_perform(TABLE_PRODUCTS_EXTRA_FIELDS, $sql_data_array, 'update', 'products_extra_fields_id=' . $key);       }       tep_redirect(tep_href_link(FILENAME_PRODUCTS_EXTRA_FIELDS));       break;     case 'remove':       //print_r($HTTP_POST_VARS['mark']);       if ($HTTP_POST_VARS['mark']) {         foreach ($HTTP_POST_VARS['mark'] as $key=>$val) {           tep_db_query("DELETE FROM " . TABLE_PRODUCTS_EXTRA_FIELDS . " WHERE products_extra_fields_id=" . tep_db_input($key));           tep_db_query("DELETE FROM " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " WHERE products_extra_fields_id=" . tep_db_input($key));         }         tep_redirect(tep_href_link(FILENAME_PRODUCTS_EXTRA_FIELDS));       }       break;   } } // Put languages information into an array for drop-down boxes   $languages=tep_get_languages();   $values[0]=array ('id' =>'0', 'text' => TEXT_ALL_LANGUAGES);   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {     $values[$i+1]=array ('id' =>$languages[$i]['id'], 'text' =>$languages[$i]['name']);   }          ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <script language="javascript" src="includes/general.js"></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr>   <td width="<?php echo BOX_WIDTH; ?>" valign="top">    <table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //-->    </table>   </td> <!-- body_text //-->   <td width="100%" valign="top">    <table border="0" width="100%" cellspacing="0" cellpadding="2">     <tr>      <td width="100%">       <table border="0" width="100%" cellspacing="0" cellpadding="0">        <tr>         <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>        </tr>       </table>      </td>     </tr>     <tr>      <td width="100%">       <!--       <div style="font-family: verdana; font-weight: bold; font-size: 17px; margin-bottom: 8px; color: #727272;">        <? echo SUBHEADING_TITLE; ?>       </div>       -->       <br />       <? echo tep_draw_form("add_field", FILENAME_PRODUCTS_EXTRA_FIELDS, 'action=add', 'post'); ?>       <table border="0" width="400" cellspacing="0" cellpadding="2">        <tr class="dataTableHeadingRow">         <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FIELDS; ?></td>         <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ORDER; ?></td>         <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_LANGUAGE; ?></td>        </tr>        <tr>         <td class="dataTableContent">          <? echo tep_draw_input_field('field[name]', $field['name'], 'size=30', false, 'text', true);?>         </td>         <td class="dataTableContent" align="center">          <? echo tep_draw_input_field('field[order]', $field['order'], 'size=5', false, 'text', true);?>         </td>         <td class="dataTableContent" align="center">          <?          echo tep_draw_pull_down_menu('field[language]', $values, '0', '');?>         </td>                 <td class="dataTableHeadingContent" align="right">     <?php echo tep_image_submit('button_add_field.gif',IMAGE_ADD_FIELD)?>         </td>        </tr>        </form>       </table>       <hr />       <br>       <?        echo tep_draw_form('extra_fields', FILENAME_PRODUCTS_EXTRA_FIELDS,'action=update','post');       ?>       <? echo $action_message; ?>       <table border="0" width="100%" cellspacing="0" cellpadding="2">        <tr class="dataTableHeadingRow">         <td class="dataTableHeadingContent" width="20">&nbsp;</td>         <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FIELDS; ?></td>         <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ORDER; ?></td>         <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_LANGUAGE; ?></td>         <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>        </tr> <? $products_extra_fields_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_EXTRA_FIELDS . " ORDER BY products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($products_extra_fields_query)) { ?>        <tr>         <td width="20">          <? echo tep_draw_checkbox_field('mark['.$extra_fields['products_extra_fields_id'].']', 1) ?>         </td>         <td class="dataTableContent">          <? echo tep_draw_input_field('field['.$extra_fields['products_extra_fields_id'].'][name]', $extra_fields['products_extra_fields_name'], 'size=30', false, 'text', true);?>         </td>         <td class="dataTableContent" align="center">          <? echo tep_draw_input_field('field['.$extra_fields['products_extra_fields_id'].'][order]', $extra_fields['products_extra_fields_order'], 'size=5', false, 'text', true);?>         </td>         <td class="dataTableContent" align="center">          <? echo tep_draw_pull_down_menu('field['.$extra_fields['products_extra_fields_id'].'][language]', $values, $extra_fields['languages_id'], ''); ?>         </td>                     <td  class="dataTableContent" align="center">          <?php           if ($extra_fields['products_extra_fields_status'] == '1') {             echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCTS_EXTRA_FIELDS, 'action=setflag&flag=0&id=' . $extra_fields['products_extra_fields_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';           }           else {             echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXTRA_FIELDS, 'action=setflag&flag=1&id=' . $extra_fields['products_extra_fields_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>&nbsp;&nbsp;' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);           }          ?>         </td>        </tr> <? } ?>        <tr>         <td colspan="4">          <?php echo tep_image_submit('button_update_fields.gif',IMAGE_UPDATE_FIELDS)?>          &nbsp;&nbsp;      <?php echo tep_image_submit('button_remove_fields.gif',IMAGE_REMOVE_FIELDS,'name="remove"')?>         </td>        </tr>        </form>       </table>      </td>     </tr>    </table>   </td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> [/code]
  5. i have text thats inputeed in the database in 1 field and is formatted with a ; to seperate values i already pull the value out of the database, but i want to make an array out of it for each value because im trying to populate a table. also i noticed with xcart theres a textbox you can type attributes in and you just do it like this small medium large and then submit it. and the code that submits it puts it all into a database field and seperates it with a ; i kinda wanna do that too, cause when i insert my data in the text area for what im doing i manually insert a ;
  6. im trying to build my site and i ran into a prob. in firefox my menu (the category menu with product cats) displays correct except for what seems like a 2px shift to the right, you can see this by looking at the grey bg and lining it up to the image thats a line above. they arnt totally aligned. id like to fix that, but if you look in ie the menu is like 40 px shifted to the right. its a ul list for the emenu and i cant figure out why firefox and ie dont display this the same. the site is [a href=\"http://www.enveamerica.com\" target=\"_blank\"]http://www.enveamerica.com[/a] and you can look at it so far. and see the bottom menu isnt displaying completly lined up in either borswer, but ie is the worst. i think its something to do with the bullet points. i duno.
  7. ok i have a question that shoudl be easy. when i delete a product from the cart i want ti to also delete all the attribute entires related to that product out of thier tables. there is a table store_classes and store_class_options i can get it to delete all records out of classes when the product is deleted, but i think i need an array or something to get rid of all the options to those classes, it only deltes the entries in the table for the first class. example color:Black White Size:small Large it will delete the classes for size and color, but it will only delte the class_options for color (black, white) the small and large stay in the table maybe i need a loop or something.. heres my code. [code] $sql_class_class = "select * from ".$prefix."store_classes where productid = $product";              $result1 = mysql_query ($sql_class_class);              $row1 = mysql_fetch_array($result1);              $classid = $row1["classid"];          $sql_class_options = "select * from ".$prefix."store_class_options where classid = $classid";             $result1 = mysql_query ($sql_class_options);             $row1 = mysql_fetch_array($result1);             $classid = $row1["classid"];        $result = "delete FROM ".$prefix."store_inventory WHERE product='$product'";        $row = mysql_query($result);        $result = "delete FROM ".$prefix."store_classes WHERE productid='$product'";        $row = mysql_query($result);        $result = "delete FROM ".$prefix."store_class_options WHERE classid='$classid'";        $row = mysql_query($result); [/code] i know why it only deletes the first class options, because it doesnt array the classid for each class, it only returns the value for the first entry
  8. can someone check out my code.. i got it to work kinda rouch, but i know the code is super sloppy because if i try and edits to the table the info displays in it goes all out of whack, im sure theres a way to shorten this. basically what this does is look in the table classes and checks to see if there is any data in there for the current productid ($product) then it looks for class options in another table to display all the options for that class. eg. color: Black Red grey thenit loops to get all the product classes. i got it to work, keep in mind the php to edit and add fields are not there yet. i was simply trying to pull the data and display it at this point. i have a feeling since the code is sloppy when that point comes its going to give me headaches, so i wanted to double check what ive done so far and see if its good. database info is an include file [code] // start attribute section echo "<h3><b><blockquote>Product Options</blockquote></b></h3><FORM ACTION=\"edit_product.php?product=$product\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">             <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">"; // get option boxes   $result = mysql_query("select * from ".$prefix."store_classes where productid = $product"); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {              $classid = $row["classid"];              $productid = $row["productid"];              $class = $row["class"];              $classtext = $row["classtext"];              $orderby = $row["orderby"];   $sql_class_options = "select * from ".$prefix."store_class_options where classid = $classid";              $result1 = mysql_query ($sql_class_options);              $row1 = mysql_fetch_array($result1);              $optionid = $row1["optionid"];              $option_name = $row1["option_name"];              $price_modifier = $row1["price_modifier"];                   echo "<tr bgcolor=\"$colour_3\"><td width=\"70\" valign=\"top\"><b>$class</b></td>";     echo "<td width=\"400\" valign=\"top\">";          $reclist = mysql_query("SELECT option_name FROM ".$prefix."store_class_options where classid = $classid")                or die(mysql_errno()." : ".mysql_error()); for ($j=0; $rec=mysql_fetch_array($reclist); $j++){      printf("<input name=\"$optionid\" type=\"text\"  class=\"file\" value=\"%s\" />&nbsp;$ +/-:<input name=\"Modifier\" type=\"text\" class=\"file\" size=\"6\" value=\"\" />&nbsp;&nbsp;<a href= 'edit_product.php?product=$product&edit=$optionid')\">Save</a>&nbsp; <a href=\"javascript:decision('Are you sure you want to delete this attribute? Click OK to continue!', 'edit_product.php?product=$product&del=$optionid')\">Delete</a> <br>\n",$rec["option_name"]);   } echo "<hr><input name=\"$optionid\" type=\"text\"  class=\"file\" value=\"\" />&nbsp;&nbsp;<a href=\"javascript:decision('Are you sure you want to add this attribute? Click OK to continue!', 'edit_product.php?product=$product&add=$value')\">Add</a>";              echo "</td>";     }          echo "</tr></table></td></tr></table></FORM>"; echo "<h3><b><blockquote>Add New Option Category</blockquote></b></h3>"; echo "<table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">             <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">   <tr bgcolor=\"$colour_3\"> <td width=\"70\" valign=\"top\"><b>Option Name:</b></td>     <td width=\"400\" valign=\"top\"><input name=\"newclass\" type=\"text\"  class=\"file\" value=\"\" />&nbsp;&nbsp;<INPUT class=\"submit\" TYPE=\"submit\" name=\"$newclass\" VALUE=\"Save\"> </td></tr></table></td></tr></table>"; [/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.