Results 1 to 10 of 13

Hybrid View

  1. #1
    Join Date
    Sep 2008
    Posts
    7
    Plugin Contributions
    0

    Default Add Info from another database???

    Hello There,

    I've spent hours searching forums and google for an answer but can't figure this out at all. I'm trying to add info from a 'master' db of mine such as ingredients, directions, warnings etc to the product_info _display page. This worked on my old oscommerce stores but have since upgraded to zen cart but tying sku from my db to products_model just isn't working. For example sku 89147=products_model 89147. In oscommerce i wrote this:
    PHP Code:
    $mysql_host "localhost";
    $mysql_db "???";
    $mysql_user "???";
    $mysql_pass "???";

    $sku $product_info['products_model'];

    $host1 mysql_connect($mysql_host$mysql_user$mysql_pass) or die(mysql_error());
    $result1 mysql_query("SELECT ingredients, directions, warning, ailments FROM wholisti_main.product WHERE sku = '".$sku."'"$host1) or die(mysql_error());

    while (
    $row mysql_fetch_array($result1)) {
        
    $ingredients $row['ingredients'];
        
    $directions $row['directions'];
        
    $warning $row['warning'];
        
    $ailments $row['ailments'];
    }
    if (!empty(
    $ingredients) ) {
        echo  
    "";    
    }
    else {  
        echo  
    "<br><br><b>Ingredients:</b> ".$ingredients."";

    but when inserting this code into zen cart the data was not outputted. i've realized that my problem lies with:
    Code:
    $sku = $product_info['products_model'];
    I've tried everything i could think of
    PHP Code:
    $sku $products_model;
    $sku $product_info['products_model'];
    $sku $products->fields['products_model']; 
    to get it to work but with no success. Can you help me?

    if you go to http://www.herbshopconnection.com/ch...100-ct-28.html you can see that the word ingredients is showing but the info from my other database.

    thanks so much for any help you can give me.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Add Info from another database???

    In what file have you inserted that code?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Sep 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Add Info from another database???

    The code i inserted into was in includes/template/CUSTOM/templates/tpl_product_info_display.php

  4. #4
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Add Info from another database???

    You'll see in that file that the product model number is contained in the $products_model variable:
    Code:
      <?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Sep 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Add Info from another database???

    Thanks DrByte,
    I did notice that and one of the 1st things i tried was $sku = $products_model; but it didn't work.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Add Info from another database???

    So, when you echo out the value of $products_model, what does it give you?
    And, is the products_model field populated for that product in your database?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v152 How can copy some products from database to another database ?
    By dmagic in forum General Questions
    Replies: 5
    Last Post: 2 Jul 2018, 02:54 PM
  2. adding an attribute from another database
    By seancon1 in forum General Questions
    Replies: 1
    Last Post: 26 Mar 2010, 03:52 AM
  3. Access another database from a custom page?
    By refreshmentshop in forum General Questions
    Replies: 1
    Last Post: 23 Sep 2009, 04:24 PM
  4. Moving database from another cart????
    By AvieLF in forum General Questions
    Replies: 3
    Last Post: 4 Jun 2007, 12:09 AM
  5. Migrate Customer Info from another Database
    By jaxbakers in forum Managing Customers and Orders
    Replies: 1
    Last Post: 1 Jul 2006, 01:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg