Results 1 to 10 of 31

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Central Coast, NSW, Australia
    Posts
    560
    Plugin Contributions
    0

    Default Change the Qty Available from Numerical to Text

    Hi,

    I'm trying to find out how to change the Qty Available from numerical to numerical and or text

    Some of our suppliers list the qty available in numerical, and others in text such as ;

    Available
    Back to Back
    >5


    Etc etc...
    Any suggestions, or assistance would be appreciated.

    Thanks,
    Mike

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Change the Qty Available from Numerical to Text

    Quote Originally Posted by Mike_Dean View Post
    Hi,

    I'm trying to find out how to change the Qty Available from numerical to numerical and or text

    Some of our suppliers list the qty available in numerical, and others in text such as ;

    Available
    Back to Back
    >5

    Etc etc...
    Any suggestions, or assistance would be appreciated.

    Thanks,
    Mike
    php has the following functions that you can use:

    strval() --> num 2 str
    intval() --> str 2 num

    I have a gut feeling that you have asked the wrong question though.
    Exactly what is it that you are trying to do?

    Cheers
    Rod

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Change the Qty Available from Numerical to Text

    Are you getting automated feeds that you import with easy populate? Or do you manually enter such information?

    The product quantity field is designed to be handled as a number, and even though it might (or might not) hold text if you gave it that, the processing functions would choke on it. There are several ways you could deal with the situation, depending on how you receive and enter the quantity, and how you want to display it.
    Last edited by gjh42; 4 Mar 2010 at 04:46 PM.

  4. #4
    Join Date
    Feb 2006
    Location
    Central Coast, NSW, Australia
    Posts
    560
    Plugin Contributions
    0

    Default Re: Change the Qty Available from Numerical to Text

    Quote Originally Posted by RodG View Post
    Exactly what is it that you are trying to do?

    Cheers
    Rod
    A number of products have the qty as 0 with "Back-to-Back" as the availability status, others have >5. This one I can handled, just run a simple formula in excel to convert >5 to 5

    Rather than simply display 0 stock, I was hoping to have those with text inserted into the Qty field.

    I realize with the Qty as text I cannot then use the reducing stock option when an order is placed, but as we rely predominantly on the suppliers feed, I can turn that option off.

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Change the Qty Available from Numerical to Text

    Quote Originally Posted by Mike_Dean View Post
    A number of products have the qty as 0 with "Back-to-Back" as the availability status, others have >5. This one I can handled, just run a simple formula in excel to convert >5 to 5

    Rather than simply display 0 stock, I was hoping to have those with text inserted into the Qty field.

    I realize with the Qty as text I cannot then use the reducing stock option when an order is placed, but as we rely predominantly on the suppliers feed, I can turn that option off.
    If this were *my* problem, the first thing I'd do would be to modify the database itself and change the field type for products.products_quantity from the current "float" into "varchar".

    This will allow the quantities to be entered as text strings.

    If you are lucky, this field will then be output to screen "as is", and your main requirement will be solved.

    I would however expect a few repercussions due to the fact that zencart also uses this field for stock control/availability, and will therefore resolve to "0", suggesting there is nothing in stock.

    Depending on the extent and effects of these repercussions I'd either decide to take care of them one at a time, or revert the database back to its original state and try a different approach.

    My alternate approach would be to *add another* field to the products table, and call it something like "products_quantity_text". It is then a matter of modifying the relevant parts of the zencart code so that any output uses this field rather than the original "products_quantity" field. As with my first approach, the amount of work required to locate and make all the modifications won't be really known until you try it.

    Cheers
    Rod

  6. #6
    Join Date
    Feb 2006
    Location
    Central Coast, NSW, Australia
    Posts
    560
    Plugin Contributions
    0

    Default Re: Change the Qty Available from Numerical to Text

    Quote Originally Posted by RodG View Post
    If this were *my* problem, the first thing I'd do would be to modify the database itself and change the field type for products.products_quantity from the current "float" into "varchar".

    This will allow the quantities to be entered as text strings.

    If you are lucky, this field will then be output to screen "as is", and your main requirement will be solved.

    I would however expect a few repercussions due to the fact that zencart also uses this field for stock control/availability, and will therefore resolve to "0", suggesting there is nothing in stock.

    Depending on the extent and effects of these repercussions I'd either decide to take care of them one at a time, or revert the database back to its original state and try a different approach.

    My alternate approach would be to *add another* field to the products table, and call it something like "products_quantity_text". It is then a matter of modifying the relevant parts of the zencart code so that any output uses this field rather than the original "products_quantity" field. As with my first approach, the amount of work required to locate and make all the modifications won't be really known until you try it.

    Cheers
    Rod
    Hey Rod,

    Very much appreciate you taking the time to document this.

    I tried the first approach, and as you suspected, Zen Cart just reverts it back to 0.. regardless of what I set the field to in the database.

    I tried a few of the options via admin eg turning off stock control, but to no avail, straight back to 0


    The second option seems feasible, (if I had the confidence to attack it.!)

    I think in the interim I may have to resort to some data manipulation in the spread sheet before I upload it

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Change the Qty Available from Numerical to Text

    A reasonable workaround may be to have the spreadsheet take all text that doesn't easily translate into a number and set it to something like 9999 (or a quantity you would never see in reality). Then a small bit of code at output locations could test for the quantity being 9999 and change an output variable's value from a number to a word like"Available" or "In Stock".

    This would not give the precision of your various suppliers' feeds, but would be basically functional.

 

 

Similar Threads

  1. Change the qty box default from 0 to blank or select all
    By idc1 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 2 Dec 2011, 09:30 PM
  2. Replies: 8
    Last Post: 16 Jun 2011, 05:11 PM
  3. Available shipping methods text change
    By luvvvvvit in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 21 Dec 2009, 12:29 AM
  4. Maximum Qty text change
    By tngraphxlady in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 10 Oct 2009, 10:43 PM
  5. How do I add 'Units available' to the qty number on the products listing page?
    By vivaraquel in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 25 Sep 2008, 11:09 PM

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