Results 1 to 10 of 14

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Option Value URL parameter?

    Quote Originally Posted by mc12345678 View Post
    Thinking about it some more, I believe that unless the sort order equals the option_value_id that the numerical sequence of the values does not equate to the sort order. (Ie, could be just as possible that the numbers are reversed but the resulting size description is the same.
    not sure what you mean by this?

    from what I can see the sort order on the attributes is only used to organise the order of the output to the page.

    the attribute id is unique to each field, therefore if there was some code added inlide to the bit that creates the drop down that does a check on each through the loop:

    PHP Code:
    $selected "";
    if (
    $option_value_id == GET['optionselected']) {
    $selected "selected";

    then which ever attribute was the match would have the "selected" added to the HTML ?
    Last edited by philip937; 15 Aug 2014 at 01:14 PM. Reason: php
    Phil Rogers
    A problem shared is a problem solved.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Option Value URL parameter?

    Quote Originally Posted by philip937 View Post
    not sure what you mean by this?

    from what I can see the sort order on the attributes is only used to organise the order of the output to the page.

    the attribute id is unique to each field, therefore if there was some code added inlide to the bit that creates the drop down that does a check on each through the loop:

    PHP Code:
    $selected "";
    if (
    $option_value_id == GET['optionselected']) {
    $selected "selected";

    then which ever attribute was the match would have the "selected" added to the HTML ?
    In your previous post, you had this:
    The default selected is the top (which is defined by the sort order which controls the order they are written to the page.
    Without further discussion/explanation, I didn't want to imply that just because something appears first in the list that it is necessarily to be identified as the default. It was not identified that the option that happened to be first in the list also happened to be the default.

    Further, if in the ZC attributes controller a default option is selected, and then the method applied above of passing a "default" selection is used, if the desired default is below in sort order the attribute controller default, the passed in default/selected will be the selected option, or possibly both may end up selected (haven't tested that thought), either way, the result would be incorrect for the desired action. Prior to assigning the passed in selection, other selections in the list should be "unselected" as a common practice, although the code cycle could be shortened to only unselect those items that appear above the passed in selection assuming that the passed in selection exists in the list.

    So, sorry for the confusion, but the statement was made in relation to the above quoted portion of the previous post.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Option Value URL parameter?

    my understanding is that by default the initially selected option isnt selected as such it simply displays the first in the list so in this case:

    HTML Code:
    <select name="id[3]" id="attrib-3">
      <option value="2">Choose Size..</option>
      <option value="5">Medium</option>
      <option value="6">Large</option>
    </select>
    the option "Choose Size.." is writted to the page first becasuse it has the lowest sort value.

    the sort value is irrelevant in what I am trying to achieve becase I plan to utilise the HTML "selected" attribute to make the option I want selected. So in the exaple the order of the list is the same but because Large has the HTML "selected" attribute, when the page loads the large should be pre-selected:

    HTML Code:
    <select name="id[3]" id="attrib-3">
      <option value="2">Choose Size..</option>
      <option value="5">Medium</option>
      <option value="6" selected>Large</option>
    </select>
    does that sound right or am I completly misunderstanding?
    Phil Rogers
    A problem shared is a problem solved.

  4. #4
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Option Value URL parameter?

    Quote Originally Posted by philip937 View Post
    my understanding is that by default the initially selected option isnt selected as such it simply displays the first in the list so in this case:

    HTML Code:
    <select name="id[3]" id="attrib-3">
      <option value="2">Choose Size..</option>
      <option value="5">Medium</option>
      <option value="6">Large</option>
    </select>
    the option "Choose Size.." is writted to the page first becasuse it has the lowest sort value.

    the sort value is irrelevant in what I am trying to achieve becase I plan to utilise the HTML "selected" attribute to make the option I want selected. So in the exaple the order of the list is the same but because Large has the HTML "selected" attribute, when the page loads the large should be pre-selected:

    HTML Code:
    <select name="id[3]" id="attrib-3">
      <option value="2">Choose Size..</option>
      <option value="5">Medium</option>
      <option value="6" selected>Large</option>
    </select>
    does that sound right or am I completly misunderstanding?
    For the "response" action that you are seeing you are correct; however, the expectation when setting up a first attribute like "Please select..." Is that it is identified as both read only and default. (Therefore would be selected when seen on screen.). So yes, the way the cart is setup (incorrectly as compared to information available in the FAQ for attributes), assigning the selected "large" as the selection would work until someone comes by later and changes/decides on say that first option to be the default/selected. At that point as said before if action is not taken to unselect that option before selecting the desired default, the desired default will not be selected as expected.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Option Value URL parameter?

    Quote Originally Posted by mc12345678 View Post
    For the "response" action that you are seeing you are correct; however, the expectation when setting up a first attribute like "Please select..." Is that it is identified as both read only and default. (Therefore would be selected when seen on screen.). So yes, the way the cart is setup (incorrectly as compared to information available in the FAQ for attributes), assigning the selected "large" as the selection would work until someone comes by later and changes/decides on say that first option to be the default/selected. At that point as said before if action is not taken to unselect that option before selecting the desired default, the desired default will not be selected as expected.
    I confused matters by including "Please Select.." my appologies, this also irrelevant. imagine the Please Select.. wasnt there. this attribute is a read only attribute and cannot be added to the cart.

    Anyway I think I have convinced myself of the solution so I will post it here once I have it working.
    Phil Rogers
    A problem shared is a problem solved.

  6. #6
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Option Value URL parameter?

    Quote Originally Posted by philip937 View Post
    I confused matters by including "Please Select.." my appologies, this also irrelevant. imagine the Please Select.. wasnt there. this attribute is a read only attribute and cannot be added to the cart.

    Anyway I think I have convinced myself of the solution so I will post it here once I have it working.
    And that's what I was pointing out, that Please select in managing the attributes should be identified as the default also. As a result, the suggested code would have no effect. Ie, under proper management of the store, the addition of a selected option in a bullet style list will have no effect and not work. It works in the current setup, because it is not setup properly and the code suggested thus far will not account for that difference. See the FAQ: http://www.zen-cart.com/content.php?...to-my-products about midway down.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Option Value URL parameter?

    Curious, since in my last review of our discussion, I didn't see an example page provided, under your current setup, what happens when the item is added to the cart without selecting one of the options, this is assuming that I understood the setup the way I have in my mind and that I incorrectly stated "read only" instead of the attribute option of display only.

    Does a warning message appear that an attribute must be selected or does the product get added to the cart without any attribute selected?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v150 Pre Select Attributes With Parameter in URL
    By ShopVille in forum Setting Up Categories, Products, Attributes
    Replies: 7
    Last Post: 3 Feb 2015, 10:31 PM
  2. v151 zen_image ambiguous value for $src parameter
    By chicagoitsystems in forum Bug Reports
    Replies: 6
    Last Post: 19 Dec 2012, 11:58 PM
  3. How to suppress URL &sort= Parameter?
    By rarpsl in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 15 Jan 2012, 11:11 PM
  4. 2nd option value need to be changed by 1st option value
    By userman in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 15 Jan 2008, 03:04 PM
  5. URL Parameter Passing
    By digger149 in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 29 Jun 2007, 12:53 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