Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Setting/Getting Hidden/Custom data

joelataylorjoelataylor Member
in Help edited October 2009
Hmmm, am I missing something here? Here's my form code:
	<input type="hidden" name="h:size" value="<?php echo $product->ship_size;?>" />

Yet when I checkout, and look at the fc_json object, my options object is empty.

Reference: http://wiki.foxycart.com/getting_started:adding_links_and_forms#session_attributes
Comments
  • Do you happen to have the code in use on a live product page I could look at? (If you don't mind. :)
  • brettbrett FoxyCart Team
    Are you looking in the right place? I'm seeing it:
    "custom_fields":{
    "size":"medium"
    },
    

    The h: is cart-wide, not product specific, so it won't show up as a product option, but rather as a session "custom_field". Is that the issue?
  • We would probably like to have the option to attach hidden fields to products, have bumped up against this already too. :-)
  • lukeluke FoxyCart Team
    You can hide product options in the cart via CSS, but it would still show up in the receipt email unless you built your own custom receipts.
  • Perfect! We are sending our own receipts already, didn't even think about hiding it on the order page.

    Thanks.
  • brettbrett FoxyCart Team
    We'd love to hear where hidden product attributes would be handy. It _sounds_ like a good idea to me, but I can't think of any good example at this point in the evening.
  • We wanted to attach a custom field that basically meant "this product is an e-course" and the value would be the internal id# required to set it up. Then if this field exists we know what type of product it is and to process it accordingly.

    So what I have done now is just use the product code and if we find that code = an internal id, then we treat it as such. But I would like to have a decoupling of the product code to this code.. on the other hand I don't want people to see it.. but If it's as easy as using CSS to hide it, that's good enough!

    We also pass a custom field to give our backend the real product cost, for when staff purchase on behalf of offline payments received (at all different discount rates) and we put a $0 transaction through the cart/feed. Anyway doesn't matter that this is visible because it's staff, but now I know the CSS trick I'll hide that too. :-)

    Cheers.
  • Hey Brett, ahh, I didn't realize hidden properties weren't product specific.
    I don't think it's THAT important to hide this variable (it's a Shipping Size: medium - kind of thing). Good to know I can make it happen if I really need to go down that road though.

    So based on other people's posts in here regarding custom shipping costs, I created my own JS for shipping and I'd like to post it somewhere to help someone else. Where should I post it? :)
  • brettbrett FoxyCart Team
    We ourselves use a code for store subscriptions that corresponds to a value in our database. I suppose we could hide that from the customer as well. Certainly an interesting idea.

    @joeltaylor: As far as custom shipping stuff goes, perhaps start a new thread, then link to it from this page:
    http://wiki.foxycart.com/docs:advanced:forum
    That'd likely be the best, as it's then available on the wiki and forum. Thanks for sharing!
Sign In or Register to comment.