Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2008
    Posts
    14
    Plugin Contributions
    0

    Default Going crazy Pleae help SQL Query- Attribs Stock

    Hey guys,

    This is my second project and i have done quite good with the FAQ's and other posts but this one i am pulling my hair out.

    Please i will be so greatful if someone can help me.

    I have installed the module "stock by attribute"

    My site is clothes shop and i have created different attributes like

    Small
    Medium
    Large
    Extra Large

    Now i need to assign quantity to each attribute i am able to do that with the module but i need for the product info page to display the quantities which i assing to the above attributes.

    Till now i have tried to do this :

    In "tpl_modules_attributes.php"

    <div class="wrapperAttribsOptions">
    <h4 class="optionName back"><?php echo $options_name[$i]; ?></h4>
    <div class="back"><?php echo "\n" . $options_menu[$i]; ?></div>
    <br class="clearBoth" />
    </div>
    I have added this query .

    $quan_query = "SELECT quantity From products_with_attributes_stock where stock_id = '" . (int)$_GET['stock_id'] . "'";

    $quan = $db->Execute($quan_query);
    and then changed the above code to the below

    <div class="back"><?php echo "\n" . $options_menu[$i] . $quan; ?></div>
    I dunno what i am doing wrong but its not working i am just pulling my hair out now. Please need some help

    I have attached a screen shot as well.

    I am not even sure if this is the right thing to do or if there is any other way of doing this.

    Easier way i mean :-)

    Will really appreciate all your help.

    Regards

    Harmeet
    Attached Images Attached Images  

  2. #2
    Join Date
    Dec 2008
    Location
    New Zealand
    Posts
    88
    Plugin Contributions
    1

    Default Re: Going crazy Pleae help SQL Query- Attribs Stock

    My guess is you are trying to display an array (of all of the mysql results), when you need to display one result.

    After this line:
    $quan = $db->Execute($quan_query);

    add these:
    print_r($quan);
    print_r($options_menu);

    My guess is you will get a list of values for both variables. If you do, changing:
    <div class="back"><?php echo "\n" . $options_menu[$i] . $quan; ?></div>
    to
    <div class="back"><?php echo "\n" . $options_menu[$i] . $quan[$i]; ?></div>
    Should fix the problem.

    The PHP online manual is really good - it has a lot of examples to copy.

    Hope this helps.

    Pat

  3. #3
    Join Date
    Dec 2008
    Location
    New Zealand
    Posts
    88
    Plugin Contributions
    1

    Default Re: Going crazy Pleae help SQL Query- Attribs Stock

    Sorry, I forgot the most important part - you should only have one query - running two queries side by side will not guarantee the results for both are in the same order. You should add the quantity to the query which lists the different sizes.

    Pat

  4. #4
    Join Date
    Feb 2010
    Location
    Sri_lanka
    Posts
    26
    Plugin Contributions
    0

    Default Re: Going crazy Pleae help SQL Query- Attribs Stock

    i also have the same problem.......is there any good news...

  5. #5
    Join Date
    Feb 2008
    Posts
    529
    Plugin Contributions
    0

    Default Re: Going crazy Pleae help SQL Query- Attribs Stock

    I also use Stock by Attributes v4.7ajax by Kuroi on 1.3.8a

    I added the mod Product Attribute Grid Display release 1.1.1 which allows me to show a nice grid in my product listing.

    The module initially broke my cart, but I found simple fix to add a : to the code of includes/extra_configures/secturity_patch138_20080919.php as found in forum post #85 of this mod (Product Attribute Grid).

    To work - change in admin Option Name Manager - the attribute type from Radio (button) to Grid.
    (I think this may be changed in zc 1.3.9a)

    I fiddled my stylesheet a little too to get my layout how I wanted it.

    Here is a sample page from my store:


    www dot meafordwool dot com/index.php?main_page=product_info&cPath=2&products_id=9

 

 

Similar Threads

  1. v154 Help with a SQL Query for Query Builder
    By lindasdd in forum Managing Customers and Orders
    Replies: 2
    Last Post: 24 Mar 2016, 01:18 PM
  2. v153 Please Help Im Going Crazy!!
    By NinerFaithful in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 8 Nov 2015, 03:23 AM
  3. v150 Going crazy need help With option manger function!!
    By Darion in forum General Questions
    Replies: 5
    Last Post: 3 Oct 2012, 12:57 AM
  4. Going Crazy - Please Help!
    By mkmcgrath23 in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 9 Dec 2007, 12:38 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