-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
2,189 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
class product_attributes | ||
{ | ||
public function get($id) | ||
{ | ||
$sql = "select * from ".TB_PREFIX."products_attributes where id = :id"; | ||
$sth = dbQuery($sql,':id',$id); | ||
$attribute = $sth->fetch(); | ||
|
||
$sql2 = "select * from ".TB_PREFIX."products_attribute_type where id = :id"; | ||
$sth2 = dbQuery($sql2,':id',$attribute['type_id']); | ||
$name = $sth2->fetch(); | ||
$attribute['type'] = $name['name']; | ||
|
||
return $attribute; | ||
} | ||
public function getName($id) | ||
{ | ||
$sql = "select * from ".TB_PREFIX."products_attributes where id = :id"; | ||
$sth = dbQuery($sql,':id',$id); | ||
$attribute = $sth->fetch(); | ||
return $attribute['name']; | ||
} | ||
public function getType($id) | ||
{ | ||
$sql = "select | ||
t.name as type | ||
from | ||
".TB_PREFIX."products_attributes as a, | ||
".TB_PREFIX."products_attribute_type as t | ||
where | ||
a.id = :id | ||
and a.type_id = t.id"; | ||
$sth = dbQuery($sql,':id',$id); | ||
$attribute = $sth->fetch(); | ||
return $attribute['type']; | ||
} | ||
public function getValue($attribute_id, $value_id) | ||
{ | ||
|
||
$details = product_attributes::get($attribute_id); | ||
|
||
if($details['type'] == 'list') | ||
{ | ||
$sql = "select value from ".TB_PREFIX."products_values where id = :id"; | ||
$sth = dbQuery($sql,':id',$value_id); | ||
$attribute = $sth->fetch(); | ||
|
||
return $attribute['value']; | ||
} else { | ||
return $value_id; | ||
} | ||
|
||
} | ||
public function getVisible($id) | ||
{ | ||
$sql = "select * from ".TB_PREFIX."products_attributes where id = :id"; | ||
$sth = dbQuery($sql,':id',$id); | ||
$attribute = $sth->fetch(); | ||
if($attribute['visible'] =='1') | ||
{ | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
|
||
} | ||
public function getAll() | ||
{ | ||
$sql = "select * from ".TB_PREFIX."products_attributes"; | ||
$sth = dbQuery($sql); | ||
$attributes = $sth->fetchAll(); | ||
return $attributes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.