Results 1 to 6 of 6
  1. #1
    Join Date
    May 2008
    Posts
    17
    Plugin Contributions
    0

    Default Two Coding Questions

    1. Where is the appropriate place in the cart, to set the php error_reporting variable to "E_NOTICE"?

    2. What does "$db->Execute()" actually return, and what can I put in my foreach loop to cycle through each row?

    EG:

    PHP Code:
    foreach($db->Execute() AS $row)
    {
       echo 
    $row['name'];
       echo 
    $row['ID'];


  2. #2
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: Two Coding Questions

    Hi,

    There are a couple of ways of getting extended error reporting .

    First Way.

    Create a file in includes/local/ called configure.php with the following code

    PHP Code:
    <?php
    define
    ('STRICT_ERROR_REPORTING'true);
    This will set error reporting to E_ALL


    or create a file in includes/extra_configures/

    called something like custom_error.php

    with the following code
    PHP Code:
    <?php
    @ini_set('display_errors''1');
    error_reporting(E_ALL);
    this ini_set is in case all error reporting is disabled in your php.ini file.

    You can of course change E_ALL to whatever you want.

  3. #3
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: Two Coding Questions

    As for the db question.

    $db->execute() returns a result set object .

    To iterate over the result set you should do

    PHP Code:
    $result $db->execute('sql query');
    while (!
    $result->EOF)
    {
    //actual query result are in the $result->fields[]  array  
    $result->moveNext();


  4. #4
    Join Date
    May 2008
    Posts
    17
    Plugin Contributions
    0

    Default Re: Two Coding Questions

    Thanks Wilt,

    It would be cool if there were a "developer's manual" or similar, that explained all the objects, variables, and the program flow...

    One more question: I need to load a javascript object with the <body onload="" > option. It looks like there's a hook in place called "$zv_onload" that does this, but where/how do you set it's value?

    I need the script to load on the "product_info" page.

    Thanks again,

    Nick

  5. #5
    Join Date
    Oct 2006
    Posts
    624
    Plugin Contributions
    0

    Default Re: Two Coding Questions

    Look into index.php for the logic on how your custom Javascript can be loaded automatically by Zen Cart into the <body onload=""> section of a page. The "$zv_onload" variable is set there.

    For a page-specific Javascript to appear on the the Product Info page's onload() section, place your custom Javascript file into the product info page that matches the particular product type.

    Your custom Javascript file must have the following syntax:

    on_load_xxx.js

    where "xxx" is the custom name you give the file.

    Based on your example. Let's say your product matches the product type Product-General and your custom Javascript file is on_load_yourfilename.js.

    For your custom Javascript to load on the particular Product Info page, your custom Javascript file should appear as follows:

    /includes/modules/pages/product_info/on_load_yourfilename.js


    PS: For more information on other default Javascript loading possibilities, look in the following file:

    /includes/templates/template_default/common/html_header.php
    Goh Koon Hoek, author of "e-Start Your Web Store with Zen Cart".
    Printed book: www.lulu.com/content/10576284
    Electronic book and Errata: www.cucumbermedia.com/store

  6. #6
    Join Date
    May 2008
    Posts
    17
    Plugin Contributions
    0

    Default Re: Two Coding Questions

    Cool, Thanks guys!

    Is there anyway to call a side box anywhere in the page? I saw the "sideboxes anywhere" contribution, but that seems to apply to the entir site, not whithin Zen Cart itself. I'd like to put something like:

    Code:
    <?php // require(DIR_WS_MODULES . 'sideboxes/categories.php'); ?>
    In the header, but I'm having varying degrees of success. It *sort of* works if I use:

    Code:
    <?php //require(DIR_WS_MODULES . zen_get_module_directory('column_right.php')); ?>
    first, but this causes problems for obvious reasons...

 

 

Similar Threads

  1. Replies: 4
    Last Post: 12 Sep 2013, 04:09 PM
  2. Two questions, hopefully you have two answers! :)
    By quickening in forum General Questions
    Replies: 4
    Last Post: 12 Aug 2008, 02:41 PM
  3. Two Questions...
    By ann0314 in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 24 May 2006, 09:35 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR