当前位置: 首页>>代码示例>>PHP>>正文


PHP VF_Schema::getLeafLevel方法代码示例

本文整理汇总了PHP中VF_Schema::getLeafLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP VF_Schema::getLeafLevel方法的具体用法?PHP VF_Schema::getLeafLevel怎么用?PHP VF_Schema::getLeafLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VF_Schema的用法示例。


在下文中一共展示了VF_Schema::getLeafLevel方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveLeafLevels

 protected function saveLeafLevels()
 {
     $schema = new VF_Schema();
     
     $select = $this->getReadAdapter()->select()
         ->from( 'elite_' . $schema->getLeafLevel() );
     $result = $select->query();
     
     $vehicleFinder = new VF_Vehicle_Finder( $schema );
     while( $row = $result->fetchObject() )
     {
         $vehicle = $vehicleFinder->findByLeaf( $row->id );
         $bind = array();
         foreach( $schema->getLevels() as $level )
         {
             $bind[ $level . '_id' ] = $vehicle->getLevel( $level )->getId();
         }
         try
         {
             $this->getReadAdapter()->insert( 'elite_definition', $bind );
         }
         catch( Exception $e )
         {
         }
     }
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:26,代码来源:Upgrader.php

示例2: getFitForSku

    /**
     * @deprecated
     */
    function getFitForSku($sku, $schema = null)
    {
        if (is_null($schema)) {
            $schema = new VF_Schema;
        }

        $sql = sprintf(
            "SELECT `entity_id` from `test_catalog_product_entity` WHERE `sku` = %s",
            $this->getReadAdapter()->quote($sku)
        );
        $r = $this->query($sql);
        $product_id = $r->fetchColumn();

        $r->closeCursor();

        $sql = sprintf(
            "SELECT `%s_id` from `elite_1_mapping` WHERE `entity_id` = %d AND `universal` = 0",
            $schema->getLeafLevel(),
            $product_id
        );
        $r = $this->query($sql);
        $leaf_id = $r->fetchColumn();
        $r->closeCursor();

        if (!$leaf_id) {
            return false;
        }
        $finder = new VF_Vehicle_Finder($schema);
        return $finder->findByLeaf($leaf_id);
    }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:33,代码来源:TestCase.php

示例3: vafDoLevel

function vafDoLevel( $level, $parent_id = 0 )
{    
    $schema = new VF_Schema();
    $finder = new VF_Level( $level );
    $parentLevel = $schema->getPrevLevel( $level );
    if( $parentLevel )
    {
        $entities = $finder->listInUse( array( $parentLevel => $parent_id ) );
    }
    else
    {
        $entities = $finder->listInUse();
    }
    echo $level . '["' . $parent_id . '"] = new Array();';
    foreach( $entities as $entity )
    {
        ?>
        var obj = new Array();
        obj["title"] = "<?=$entity->getTitle()?>";
        obj["id"] = "<?=$entity->getId()?>";
        <?=$level?>["<?=$parent_id?>"].push( obj );
        <?php
        if( $level != $schema->getLeafLevel() )
        {
            vafDoLevel( $schema->getNextLevel($level), $entity->getId() );
        }
        echo "\n";
    }
    
}
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:30,代码来源:loader_offline.js.php

示例4: removeFitments

 function removeFitments($product)
 {
     $schema = new \VF_Schema();
     if (is_array($this->params()->fromPost('vaf-delete')) && count($this->params()->fromPost('vaf-delete')) >= 1) {
         foreach ($this->params()->fromPost('vaf-delete', array()) as $fit) {
             $fit = explode('-', $fit);
             $level = $fit[0];
             $fit = $fit[1];
             if ($level == $schema->getLeafLevel()) {
                 $product->deleteVafFit($fit);
             }
         }
     }
 }
开发者ID:vehiclefits,项目名称:admin,代码行数:14,代码来源:IndexController.php

示例5: removeFitments

 function removeFitments($request, $product)
 {
     $schema = new VF_Schema();
     if (is_array($request->getParam('vaf-delete')) && count($request->getParam('vaf-delete')) >= 1) {
         foreach ($request->getParam('vaf-delete', array()) as $fit) {
             $fit = explode('-', $fit);
             $level = $fit[0];
             $fit = $fit[1];
             if ($level == $schema->getLeafLevel()) {
                 $product->deleteVafFit($fit);
             }
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:14,代码来源:Observer.php

示例6: getLeafLevel

 function getLeafLevel()
 {
     $schema = new VF_Schema();
     return $schema->getLeafLevel();
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:5,代码来源:Elite_Vaf_Helper_Data.php

示例7: getLeafValue

 function getLeafValue()
 {
     $leaf = $this->schema->getLeafLevel();
     return $this->getValue($leaf);
 }
开发者ID:vehiclefits,项目名称:library,代码行数:5,代码来源:Vehicle.php

示例8: duplicate

 /**
  * Create duplicate
  *
  * @return Mage_Catalog_Model_Product
  */
 function duplicate()
 {
     $schema = new VF_Schema();
     $vehicleFinder = new VF_Vehicle_Finder($schema);
     $leaf = $schema->getLeafLevel() . '_id';
     $newProduct = parent::duplicate();
     foreach ($this->getFits() as $fit) {
         // 2.x has a bug that it inserts blank fitments, which prevents duplicating products here. Simple workaround for 2.x
         if (!$fit->{$leaf}) {
             continue;
         }
         $levelIDs = array();
         foreach ($schema->getLevels() as $level) {
             $levelIDs[$level . '_id'] = $fit->{$level . '_id'};
         }
         $vehicle = $vehicleFinder->findOneByLevelIds($levelIDs);
         if (is_object($vehicle)) {
             $newProduct->insertMapping($vehicle);
         }
     }
     if ($this->isUniversal()) {
         $newProduct->setUniversal(true);
     }
     return $newProduct;
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:30,代码来源:Product.php

示例9: testGetLeafLevel

 function testGetLeafLevel()
 {
     $schema = new VF_Schema();
     $this->assertEquals( self::ENTITY_TYPE_YEAR, $schema->getLeafLevel(), 'root level should be "year"' );
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:5,代码来源:SchemaTest.php

示例10: duplicate

 /**
  * Create duplicate
  *
  * @return Mage_Catalog_Model_Product
  */
 function duplicate()
 {
     $schema = new VF_Schema();
     $vehicleFinder = new VF_Vehicle_Finder($schema);
     $leaf = $schema->getLeafLevel() . '_id';
     $newProduct = parent::duplicate();
     foreach ($this->getFits() as $fit) {
         print_r($fit);
         exit;
         $vehicle = $vehicleFinder->findByLeaf($fit->{$leaf});
         $newProduct->insertMapping($vehicle);
     }
     if ($this->isUniversal()) {
         $newProduct->setUniversal(true);
     }
     return $newProduct;
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:22,代码来源:Product.php


注:本文中的VF_Schema::getLeafLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。