'Store Default'"); // if orderby isn't set in the category, grab it from the product if (!$orderby) $orderby = $SC['settings']['Order_Products_By']; // if not set at category OR product, then set it to "Name" if(!$orderby || $orderby == "null") $orderby = "Name"; // grab the settings for ordering products from the category if (!$orderhow) $orderhow = @get_field_val("Categories","Order_Products_How","record_number = $cat_rn AND Order_Products_How <> 'Store Default'"); // if orderhow isn't set in the category, grab it from the product if (!$orderhow) $orderhow = $SC['settings']['Order_Products_How']; if($orderhow) { if ($orderhow == "Ascending") $orderhow = "ASC"; if ($orderhow == "Descending") $orderhow = "DESC"; } else { $orderhow = "ASC"; } // if random is set, then we need to grab a random subset of the existing product records....need to unset limit, grab random records from result of all products, and return that array if ($random && isset($limit)) { $random_limit = str_replace("LIMIT 0,","",$limit) + 1; unset($limit); } // if out of stock items are set to not be displayed in store settings if($SC['inventory_control'] && $SC['out_of_stock_behavior'] == "1") { $products = sc_query( "SELECT prod.record_number, cat.record_number AS Category FROM Products prod INNER JOIN REL_Products__Categories rel_p_c ON rel_p_c.Products_rn = prod.record_number INNER JOIN Categories cat ON rel_p_c.Categories_rn = cat.record_number INNER JOIN REL_Products__Warehouses rel_p_w ON rel_p_w.Products_rn = prod.record_number WHERE cat.record_number = $cat_rn AND rel_p_w.Stock > 0 $exclude GROUP BY rel_p_w.Products_rn ORDER BY prod.$orderby $orderhow $limit", MYSQL_BOTH,1); } else { $products = sc_query( "SELECT prod.record_number, cat.record_number AS Category FROM Categories cat, Products prod, REL_Products__Categories rel_p_c WHERE cat.record_number = rel_p_c.Categories_rn AND prod.record_number = rel_p_c.Products_rn AND cat.record_number = $cat_rn AND prod.Not_For_Sale != 1 $exclude ORDER BY prod.$orderby $orderhow $limit", MYSQL_BOTH,1); } if ($random) { $prod_count = count($products); // if less products are returned then the limit, then use the number of products as the limit for generating random numbers if ($prod_count < $random_limit) $random_limit = $prod_count; $prod_rns = array(); // loop while the number of random prod rns is less than what we need while(count($prod_rns) < $random_limit) { $rand = rand(0,$prod_count-1); if (!in_array($rand,$prod_rns)) $prod_rns[] = $rand; } // grab the products randomly from the original products array foreach($prod_rns as $prod_rn) $random_products[] = $products[$prod_rn]; return $random_products; } return $products; } ?>
"; $data = inputs2array($html); // now, data looks like this: // $data['fname'] == 'Fred'; // $data['lname'] == 'Flintstone'; Function returns false on error, or if there are no matches **************************************************************************************************************/ function inputs2array($html) { // make sure we have input! if (!$html) return false; // pull out the field names and values from the input tags :) preg_match_all("/< ?input[^>]+name ?= ?['|\"]([^>'\"]+)['|\"][^>]+value ?= ?['|\"]([^>'\"]+)['|\"][^>]+>/",$html,$matches); // see if there were any matches. index 1 has the entire field. 2 has the field names, 3 has the field values. if (is_array($matches[1])) { // grab the arrays we need, to make the for loop a little more readable $fnames =& $matches[1]; $values =& $matches[2]; for($x=0;$fnames[$x];$x++) { $data[$fnames[$x]] = $values[$x]; } return $data; } else { return false; } } ?>Query from count_records(): $query
"; } else { $result = mysql_query ($query); if (is_resource($result)) { while ($row = mysql_fetch_array ($result)) { $records[] = $row; } return $records[0][0]; } else { return 0; } } } ?>Query from get_sum(): $qry
"; } else { $result = mysql_query($qry); if (is_resource($result)) { while ($row = mysql_fetch_array ($result)) { $records[] = $row; } return $records[0][0]; } } } ?>Payment Gateways cannot be edited in demo mode."; return; } elseif ($table == 'Payment_Gateways') { // this code will disable all payment gateways IF one is being enabled. This will keep the cart from allowing // more than one enabled gateway if ($data['Enabled'] == 1) sc_query('UPDATE Payment_Gateways SET Enabled = 0'); } if ($SC['demo_mode']) { // deal with Nav Blocks in demo mode if ($table == 'Navigation_Block') { // remove Show_When from data...it's off limits unset($data['Show_When']); // if content has PHP in it, wipe it out if (strstr($data['Content'],'Field Sets cannot be added in demo mode."; return; } elseif ($table == 'Field_Definition') { print "
Field Definitions cannot be added in demo mode.
"; return; } } // $data must be an array...if it's not...bail if (!is_array($data)) return; // make sure record exists before we try to update it! $existing_record = get_field_val($table,"record_number",$where); if (isset($existing_record)) { foreach(array_keys($data) as $field_name) { $data[$field_name] = sc_mysql_escape($data[$field_name]); // if set string isn't set, set it....else append with a comma in between if (!$set_string) { $set_string = "`$field_name` = '$data[$field_name]'"; } else { $set_string = "$set_string, `$field_name` = '$data[$field_name]'"; } } $query = "UPDATE $table SET $set_string WHERE $where"; if ($test) print "$query
"; mysql_query($query) or sc_show_diag("Query Failed: ". mysql_error()); } } ?> and tags // $height - height of popup // $width - width of popup // $scrollbars - set to 'yes' or 'no' // $resizable - set to 'yes' or 'no' // // File modified on 03/08/2005 - bug fix for problems causing the JS Popup function to not appear function Popup_Window($page, $link_content, $width, $height, $scrollbars, $resizable,$class="product_options_details_link"){ return "$link_content"; } ?> Number of elements in array: ".count($array)." Key Value "; foreach(array_keys($array) as $key) { print " $key "; if (is_array($array[$key])) { sc_print_array($array[$key]); } else { print $array[$key]; } print " "; } print ""; } } ?>"; } ?>"; if ($return_var) { return $stylesheet; } else { print $stylesheet; } } ?> $value) { if (is_array($data[$key])) { $data[$key] = urlencode_all($data[$key]); } else { $data[$key] = urlencode($data[$key]); } } return $data; } ?> 0 GROUP BY ps.Product_rn ORDER BY ps.Quantity DESC LIMIT 0,$result_qty "; } else { $qry = " SELECT ps.Product_rn ,p.* FROM Products_Sold ps LEFT JOIN Products p ON p.record_number = ps.Product_rn WHERE p.record_number != 432 AND p.Not_For_Sale != 1 ORDER BY ps.Quantity DESC LIMIT 0,$result_qty "; } return sc_query($qry,MYSQL_ASSOC,1); } ?>"; // for each possible value of $basis, determine number of times this discount has been used, and store in $total_used if ($basis == "order") { if ($SC['order']) { // loop through items in order for($x=0;$SC['order'][$x];$x++) { $item = $SC['order'][$x]; if ($item['discount']['rn'] == $discount['rn']) { $total_used = $total_used + $item['discount']['use_count']; } } } else { $total_used = 0; } } // check $total_used against $limit, and alter discount accordingly if ($total_used > $limit) { //print "here..............
"; } return $discount; } ?>Powered by Squirrelcart © PHP Shopping Cart Software"; } else { $image_tag = @get_image("Cart_Images","powered by sc $logo",0,0,0,"Powered by Squirrelcart PHP Shopping Cart Software"); if (!$image_tag) { // image was uploaded, but never added to the cart images table....add it below $data['Name'] = "powered by sc $logo"; $data['Image'] = "squirrelcart/images/cart/powered_by_sc_".$logo.".gif"; @add_record("Cart_Images",$data); $image_tag = get_image("Cart_Images","powered by sc $logo",0,0,0,"Powered by Squirrelcart PHP Shopping Cart Software"); } $sc_logo = "$image_tag

"; } print $sc_logo; } ?> 1728) { $result['dimensional_weight'] = round($cubic_inches / 194); } // calculate some UPS pkg info /* Use dimensional weight as the billable weight on packages that measure more than one cubic foot (1,728 in.), for domestic shipments and shipments to Puerto Rico using these services: 17 - UPS Next Day Air Early A.M.® 16 - UPS Next Day Air® 15 - UPS Next Day Air Saver® 13 - UPS 2nd Day Air A.M.® 6 - UPS 2nd Day Air® 14 - UPS 3 Day Select® */ // check to see if shipment is domestic (US to US, or US to Puerto Rico) $domestic = (($SC['order']['address']['Ship_Country'] == 180 || $SC['order']['address']['Ship_Country'] == 228) && $ship_from_country == 180); // if one of the services above, and domestic, then figure out billable weight based on dimensional weight if (($service_rn == 17 || $service_rn == 16 || $service_rn == 15 || $service_rn == 13 || $service_rn == 6 || $service_rn == 14) && $domestic) { if ($result['dimensional_weight']) $result['UPS_billable_weight'] = $result['dimensional_weight']; //billable weight is the dimensional weight } // Check for Oversize, only for UPS Ground, and in the future, UPS Standard to Canada if ($service_rn == 5) { // 5 is UPS Ground // determine if package is an Oversize type, and if so, set the billable weight /* Oversize 1 Package Conditions Your package is considered Oversize 1 (OS1) when all of these conditions apply: Your package´s combined length and girth exceeds 84 in. (213 cm.) Your package´s combined length and girth is equal to or less than 108 in. (270 cm.) Your package´s actual weight is less than 30 lbs. (13.6 kgs.) The billable weight for each OS1 package is 30 lbs. (13.6 kgs.) */ if ($result['length_girth'] > 84 && $result['length_girth'] <= 108 && $result['weight'] < 30) { $result['UPS_oversize'] = "Oversize 1"; $result['UPS_billable_weight'] = 30; } /* Oversize 2 Package Conditions Your package is considered Oversize 2 (OS2) when all of these conditions apply: Your package’s combined length and girth exceeds 108 in. (270 cm.) Your package’s combined length and girth is equal to or less than 130 in. (330 cm.) Your package’s actual weight is less than 70 lbs. (31.5 kgs.) The billable weight for each OS2 package is 70 lbs. (31.5 kgs.) */ if ($result['length_girth'] > 108 && $result['length_girth'] <= 130 && $result['weight'] < 70) { $result['UPS_oversize'] = "Oversize 2"; $result['UPS_billable_weight'] = 70; } /* Oversize 3 Package Conditions Your package is considered Oversize 3 (OS3) when all of these conditions apply: Your package’s combined length and girth exceeds 130 in. (330 cm.) Your package’s combined length and girth is equal to or less than 165 in. (419 cm.) Your package’s actual weight is less than 90 lbs. (40.9 kgs.) The billable weight for each OS3 package is 90 lbs. (40.9 kgs.) */ if ($result['length_girth'] > 130 && $result['length_girth'] <= 165 && $result['weight'] < 90) { $result['UPS_oversize'] = "Oversize 3"; $result['UPS_billable_weight'] = 90; } /* Large Package Surcharge A Large Package Surcharge of $40 will be applied to all UPS Ground packages, including Hundredweight, when the size of the package exceeds 130 in. (330 cm.) in length and girth combined. */ if ($result['length_girth'] > 130) $result['UPS_large_pkg_surcharge'] = 1; } // store in cache to save time later $SC['order']['shipping']['pkg_dim_cache'][$item_index][$service_rn] = $result; return $result; } } ?>"; print "Total weight is $total_weight
"; // calculate boxes weight and volume for($x=0;$boxes[$x];$x++){ $box=$boxes[$x]; $width=$box["Width"]; $height=$box["Height"]; $depth=$box["Depth"]; $boxes[$x]["Volume"] = ($width * $height * $depth); //vol of this one box } print "Box ".$boxes[1]["Name"]." has a volume of ".$boxes[1]["Volume"]." cubic $dim_unit.
"; for($x=0; $boxes[$x]; $x++){ $box=$boxes[$x]; $vol=$box["Volume"]; if ($vol >= $items_vol) $ok_box[] = $box; } for($x=0;$ok_box[$x];$x++){ print "Everything will fit in a \"".$ok_box[$x]["Name"]."\". Total package weight will be ".($total_weight + $ok_box[$x]["Weight"])." $weight_unit.
"; } print $ok_box[0]["Volume"]; } ?>
Fatal error: Call to undefined function get_tables() in /var/www/vhosts/handmadebymachine.com/httpdocs/store/squirrelcart/functions/common/mysql/sc_db_connect.func.php on line 69