コード例 #1
0
 /**
  * @param array|null $sortWeights
  * @param float $expected
  * @dataProvider getSortWeightDataProvider
  */
 public function testGetSortWeight($sortWeights, $expected)
 {
     $setId = 123;
     $this->_model->setAttributeSetInfo(array($setId => $sortWeights));
     $this->assertEquals($expected, $this->_model->getSortWeight($setId));
 }
コード例 #2
0
ファイル: Abstract.php プロジェクト: nemphys/magento2
 /**
  * Compare attributes
  *
  * @param Mage_Eav_Model_Entity_Attribute $attribute1
  * @param Mage_Eav_Model_Entity_Attribute $attribute2
  * @return int
  */
 public function attributesCompare($attribute1, $attribute2)
 {
     $sort1 = $attribute1->getSortWeight((int) $this->_sortingSetId);
     $sort2 = $attribute2->getSortWeight((int) $this->_sortingSetId);
     if ($sort1 > $sort2) {
         return 1;
     } elseif ($sort1 < $sort2) {
         return -1;
     }
     return 0;
 }