Jump to content

PHP Script connection problems


RJGonzalez

Recommended Posts

I set out to get a script in order to sale products by SQFT. Got it done, now I can get hold of the people who build it, to fix various problems. The biggest problem now is a connection error i am getting. you can recreate by visiting the following site http://secure.ad-advice.com after that is figure it out i would like to change the setup(everything is packed together) example: html code is within each file, would like to rebuild it so it has a header template and a footer template, recommendations are always welcome.

Link to comment
Share on other sites

What error? Please post the code that is relevant to the problem. Since this was written by a third party, thread is being moved to third party code help.

 

I don't know where the error is at i can see the error when the page loads on the browser that is at http://secure.ad-advice.com it start blinking like trying to connect and it reloads but never gets the connection completed, since it has been moved to the third party thread, i will add the following. at first i wanted to add the SQFT products feature to my original cart (PrestaShop) but it was to complicated so i got help to build a simple cart to manage the Per SQFT product sales

Link to comment
Share on other sites

I have been working and made it happen with another cart. now the situation i have is the following. dropdown menu is printing out of order example:

Dropdown

1

3

2

 

Following the ini code that has to do with that issue:

 

function iniProductVariants() {
global $osC_Database, $osC_Language, $osC_Currencies;

$products_variants = array();

$Qvariants = $osC_Database->query('select * from :table_products_variants where products_id = :products_id order by is_default DESC');
$Qvariants->bindTable(':table_products_variants', TABLE_PRODUCTS_VARIANTS);
$Qvariants->bindInt(':products_id', $this->getID());
$Qvariants->execute();

$groups = array();
$values = array();
$groups_values = array();
while ($Qvariants->next()) {
$Qvalues = $osC_Database->query('select pve.products_variants_groups_id as groups_id, pve.products_variants_values_id as variants_values_id, pvg.products_variants_groups_name as groups_name, pvv.products_variants_values_name as variants_values_name from :table_products_variants_entries pve, :table_products_variants_groups pvg, :table_products_variants_values pvv where pve.products_variants_groups_id = pvg.products_variants_groups_id and pve.products_variants_values_id = pvv.products_variants_values_id and pvg.language_id = pvv.language_id and pvg.language_id = :language_id and pve.products_variants_id = :products_variants_id order by pve.products_variants_groups_id');
$Qvalues->bindTable(':table_products_variants_entries', TABLE_PRODUCTS_VARIANTS_ENTRIES);
$Qvalues->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
$Qvalues->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
$Qvalues->bindInt(':language_id', $osC_Language->getID());
$Qvalues->bindInt(':products_variants_id', $Qvariants->valueInt('products_variants_id'));
$Qvalues->execute();

$variants = array();
$groups_name = array();
while ($Qvalues->next()) {
$variants[$Qvalues->value('groups_id')] = $Qvalues->value('variants_values_id');
$groups_name[$Qvalues->value('groups_name')] = $Qvalues->value('variants_values_name');

$groups[$Qvalues->value('groups_id')] = $Qvalues->value('groups_name');
$values[$Qvalues->value('variants_values_id')] = $Qvalues->value('variants_values_name');

if (!is_array($groups_values[$Qvalues->value('groups_id')])) {
$groups_values[$Qvalues->value('groups_id')] = array();
}

if (!in_array($Qvalues->value('variants_values_id'), $groups_values[$Qvalues->value('groups_id')])) {
$groups_values[$Qvalues->value('groups_id')][] = $Qvalues->value('variants_values_id');
}
}
$Qvalues->freeResult();
$product_id_string = osc_get_product_id_string($this->getID(), $variants);

$products_variants[$product_id_string]['variants_id'] = $Qvariants->valueInt('products_variants_id');
$products_variants[$product_id_string]['is_default'] = $Qvariants->valueInt('is_default');
$products_variants[$product_id_string]['sku'] = $Qvariants->value('products_sku');
$products_variants[$product_id_string]['price'] = $Qvariants->value('products_price');
$products_variants[$product_id_string]['display_price'] = $osC_Currencies->displayPrice($Qvariants->value('products_price'), $this->_data['tax_class_id']);
$products_variants[$product_id_string]['status'] = $Qvariants->valueInt('products_status');
//quantity will not be cached, it will be retrieved at runtime
// $products_variants[$product_id_string]['quantity'] = $Qvariants->value('products_quantity');
$products_variants[$product_id_string]['weight'] = $Qvariants->value('products_weight');
$products_variants[$product_id_string]['image'] = $this->getImageByID($Qvariants->value('products_images_id'));
$products_variants[$product_id_string]['groups_id'] = $variants;
$products_variants[$product_id_string]['groups_name'] = $groups_name;
$products_variants[$product_id_string]['filename'] = $Qvariants->value('filename');
$products_variants[$product_id_string]['cache_filename'] = $Qvariants->value('cache_filename');

if ($Qvariants->valueInt('is_default') == 1) {
$this->_data['default_variant'] = $products_variants[$product_id_string];
$this->_data['default_variant']['product_id_string'] = $product_id_string;
}

if ($this->_data['type'] == PRODUCT_TYPE_DOWNLOADABLE) {
$products_variants[$product_id_string]['filename'] = $Qvariants->value('filename');
$products_variants[$product_id_string]['cache_filename'] = $Qvariants->value('cache_filename');
}
}

$Qvariants->freeResult();

$this->_data['variants'] = $products_variants;
$this->_data['variants_groups'] = $groups;
$this->_data['variants_values'] = $values;
$this->_data['variants_groups_values'] = $groups_values;
}

 

What would i need to edit in order to have it printing in order?

Link to comment
Share on other sites

here is the top missing part it deals with the drop down box

 

    function getProductVariantsId($variants){
      $product_id_string = osc_get_product_id_string($this->getID(), $variants);

      if(isset($this->_data['variants']) && isset($this->_data['variants'][$product_id_string])){
        return $this->_data['variants'][$product_id_string]['variants_id'];
      }else{
        return false;
      }
    }
    
    function getVariantsComboboxArray() {
      if ($this->hasVariants()) {
        $combobox_array = array();

        foreach ($this->_data['variants_groups'] as $groups_id => $groups_name) {
          $values = array();
          foreach($this->_data['variants_groups_values'][$groups_id] as $values_id) {
            $values[] = array('id' => $values_id, 'text' => $this->_data['variants_values'][$values_id]);
          }
          
          $combobox_array[$groups_name] = osc_draw_pull_down_menu(
            'variants[' . $groups_id . ']', 
            $values, 
            $this->_data['default_variant']['groups_id'][$groups_id]);
        }
        return $combobox_array;
      }
      
      return false;
    }
    
    function getDefaultVariant() {
      if ($this->hasVariants()) {
        return $this->_data['default_variant'];
      }
      
      return false;
    }

 

MOD EDIT:

 . . . 

tags added.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.