Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Join Date
    Dec 2014
    Posts
    24
    Plugin Contributions
    0

    Default how to pass a variable to attribute text field.

    hi,

    I use attribute controller to create a customer input text field on product info page. i would like to pass a variable to this input field and bypass the customer input. How can i do it and which files should i edit?

    version 1.5.5f

    many thanks
    Last edited by caborela88; 4 Nov 2018 at 06:56 AM. Reason: missing version

  2. #2
    Join Date
    Dec 2014
    Posts
    24
    Plugin Contributions
    0

    Default Re: how to pass a variable to attribute text field.

    it seems like i need to modify the shopping_cart.php file.

    how can i pass the variable from tpl_product_info_display.php to shopping_cart.php ?
    i tried to add include(../templates/responsive_classic/templates/tpl_product_info_display.php) on shopping_cart.php but it doesn't work.

    anyone can give me some idea?

    thanks

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,494
    Plugin Contributions
    88

    Default Re: how to pass a variable to attribute text field.

    You could use a jQuery "helper" on the product-info page to pre-load (or load) that text into the input field.

    Zen Cart 1.5.5f's attribute-formatting includes a unique HTML id attribute for each product-attribute block, so your jQuery should have a good "anchor" for its processing.

  4. #4
    Join Date
    Dec 2014
    Posts
    24
    Plugin Contributions
    0

    Default Re: how to pass a variable to attribute text field.

    Quote Originally Posted by lat9 View Post
    You could use a jQuery "helper" on the product-info page to pre-load (or load) that text into the input field.

    Zen Cart 1.5.5f's attribute-formatting includes a unique HTML id attribute for each product-attribute block, so your jQuery should have a good "anchor" for its processing.


    thanks so much!
    i will give it a try!

  5. #5
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,151
    Plugin Contributions
    11

    Default Re: how to pass a variable to attribute text field.

    I'm a bit confused at what you are trying to fix here.

    You've created a text attribute input field.
    You want to pre-fill the attribute input field so the customer cannot enter text or so the customer can add additional text?

    What your description sounds like is, "I want to create a text field that the customer enters text into, but pre-fill it so they can't."

  6. #6
    Join Date
    Dec 2014
    Posts
    24
    Plugin Contributions
    0

    Default Re: how to pass a variable to attribute text field.

    Quote Originally Posted by dbltoe View Post
    I'm a bit confused at what you are trying to fix here.

    You've created a text attribute input field.
    You want to pre-fill the attribute input field so the customer cannot enter text or so the customer can add additional text?

    What your description sounds like is, "I want to create a text field that the customer enters text into, but pre-fill it so they can't."


    Hi dbltoe,

    i need an input field to store a variable fetched from another site. Using the attribute text input i do not need to recreate a table or field in my database.

  7. #7
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: how to pass a variable to attribute text field.

    Quote Originally Posted by caborela88 View Post
    it seems like i need to modify the shopping_cart.php file.

    how can i pass the variable from tpl_product_info_display.php to shopping_cart.php ?
    i tried to add include(../templates/responsive_classic/templates/tpl_product_info_display.php) on shopping_cart.php but it doesn't work.

    anyone can give me some idea?

    thanks
    You'll need to pass the data through:

    Your source -> New/existing database table/field -> Class or Function or Module file -> includes/modules/pages/product_info/main_template_vars.php -> Template file tpl_product_info.php
    Then you can pass the data to the input field and perhaps use a php injection to add the text to the input field label text. Similar to the search input field that ships with Zen Cart.

    Once that input field records when the page is submitted (add to cart) you'll need to continue moving the data/variable to the next screen (assumed shopping cart) by repeating the first step ^.

    Twitch Hidden Searchable Model Number ships with complete install instructions to pass the new products_model_spoon through the cart as static text output with CSS markup. Product info page, shopping cart and so on.


    Check it out in the forum plugins ↑ or as always on my website ↓ :)
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base8 - Obsidian - This, is what's new.

  8. #8
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: how to pass a variable to attribute text field.

    Quote Originally Posted by caborela88 View Post
    Hi dbltoe,

    i need an input field to store a variable fetched from another site. Using the attribute text input i do not need to recreate a table or field in my database.
    If this is the case where the data to be stored and then pased on really has nothing to do with user interaction (other than perhaps coming to and submitting the product, then perhaps an includes/extra_cart_actions file may be better suited to prevent any front end modifications from having an effect. The field for the text attribute would be populated by submission of a product where whatever criteria desired is met and then the data collected from your "other" site. Further modifications can be made either not to offer up the specific text field or to hide it from view. In either way the submission process either initially assigns the value and then maintains it or obtains the desired value each time. Regardless understand that the data to be collected depends on the satisfactory maintenance of and ability to retrieve the desried data from this other site...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Dec 2014
    Posts
    24
    Plugin Contributions
    0

    Default Re: how to pass a variable to attribute text field.

    Thanks for you guys response!

    i think i m not so good on programming.
    is that a easy way to accomplish this?

    Can i just pass the parameter via url from product_info_page to shopping_cart_page?

    like below?
    /index.php?main_page=shopping_cart&Text=SomeText

    how can i do it?
    Last edited by caborela88; 6 Nov 2018 at 07:36 PM.

  10. #10
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: how to pass a variable to attribute text field.

    The real question is how are you passing the variable to the product info page from another site?
    Website - Github. Like the ZCA Bootstrap 4 Template? Donations Welcome. Bootstrap Plugins?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Can I have text showing inside an attribute text field
    By jcrewe in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 4 Jan 2012, 10:48 PM
  2. Text Attribute with Variable Amount for Gift Card
    By Janrizga in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 25 Aug 2010, 02:13 AM
  3. Need variables for idevaffiliate variable pass ons?
    By s2kinteg916 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 31 May 2009, 07:41 PM
  4. Pass variable from link to Discount Coupon Code
    By MrForce in forum General Questions
    Replies: 0
    Last Post: 17 Apr 2008, 06:07 AM

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