本文整理汇总了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 )
{
}
}
}
示例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);
}
示例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";
}
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例6: getLeafLevel
function getLeafLevel()
{
$schema = new VF_Schema();
return $schema->getLeafLevel();
}
示例7: getLeafValue
function getLeafValue()
{
$leaf = $this->schema->getLeafLevel();
return $this->getValue($leaf);
}
示例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;
}
示例9: testGetLeafLevel
function testGetLeafLevel()
{
$schema = new VF_Schema();
$this->assertEquals( self::ENTITY_TYPE_YEAR, $schema->getLeafLevel(), 'root level should be "year"' );
}
示例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;
}