Skip to content

Commit

Permalink
Display only entered attribute combinations
Browse files Browse the repository at this point in the history
When displaying product using Dynamic Dropdowns, the option to display out-of-stock attributes previously displayed every attribute combination that could exist as determined by variations off of the attributes controller data.  This could mean that the store owner may have entered a product that only had two variants, but the attributes would support three or more and dynamic dropdowns would display every such variation.

But, with this modification, now only the variations that have been defined by the store owner will be displayed when displaying out-of-stock attributes.  If it *is* desired to show every potential combination, then in the new code:
````php
            if ($productAttrAreSBA !== false && (true /* <- true to only display product variants available as entered, 
                                                         false to display every attribute combination possible from the attributes controller data for that product  */ 
                                                  ? !is_null($productAttrAreSBA) 
                                                  : true)) {
              $combinations[] = array('comb'=>$newcomb, 'id'=>substr($newid,1), 'text'=>$newtext);
              if ($newisselected) {
                $selected_combination = sizeof($combinations)-1;
              }
            }
````
Follow the instructions about changing the true to a false. This will become an admin controllable switch, but in the mean time, functionality is provided.
  • Loading branch information
mc12345678 committed Jun 22, 2017
1 parent 3f014b9 commit d742898
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion includes/classes/pad_base.php
Expand Up @@ -489,7 +489,10 @@ function _build_attributes_combinations($attributes, $showoos, $markoos, &$combi
default: $newtext=substr($newtext,2);
break;
}
if ($productAttrAreSBA !== false) {
if ($productAttrAreSBA !== false && (true /* <- true to only display product variants available as entered,
false to display every attribute combination possible from the attributes controller data for that product */
? !is_null($productAttrAreSBA)
: true)) {
$combinations[] = array('comb'=>$newcomb, 'id'=>substr($newid,1), 'text'=>$newtext);
if ($newisselected) {
$selected_combination = sizeof($combinations)-1;
Expand Down

0 comments on commit d742898

Please sign in to comment.