No announcement yet.

Dynamically pulling an extra field in Search Results

  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamically pulling an extra field in Search Results

    I don't know if you've seen the thread or not, but recently I created a work-around that made sure the microdata on the product pages was always supplying the correct "availability" variable. Currently, 3dcart doesn't. It was important to me because it allowed me to opt-in to automatic updating by Google instead of programming an automated Google Feed -- or worse, doing it manually. You can read all about it and the see the code to fix it in the Microdata Availability Error thread.

    The problem with my fix is that product availability in my search results now reads out as the results: InStock, OutOfStock, and PreOrder -- instead of: "In Stock!", "Out of Stock, Call for Estimated Availability," and "PREORDER: Call for Estimated Delivery Date." Because my workaround on the microdata issue populates the In Stock/Out of Stock/Backorder messages with formatted variables, that's what pops up in my search results.

    My jQuery script (also outlined in the linked thread) pulls data from the product page to dynamically change the Availability message. However, the search results page pulls the same information server-side and populates it several times over with the same variable. When I apply my script to search.html, it only affects the first search result.

    So... anyone have any clues how to dynamically change the [availability] of search results? I tried using an extra field, but that doesn't populate; I get a page of results where every item says: "Availability: [extra_field_8]" instead of the products' values for that field.

    I'm I just going to have to write some javascript that crawls the page for instances of "InStock," "OutOfStock," and "PreOrder" and replace them? This is not ideal as I sometimes need to have a custom availability value (that I put into a product's Extra Field 8).
    Webmaster: Texas Media Systems