docs/api/source-catalog.model.design.layout.html
| 1: | <?php |
| 2: | namespace Opencart\Catalog\Model\Design; |
| 3: | /** |
| 4: | * Class Layout |
| 5: | * |
| 6: | * @package Opencart\Catalog\Model\Design |
| 7: | */ |
| 8: | class Layout extends \Opencart\System\Engine\Model { |
| 9: | /** |
| 10: | * Get Layout |
| 11: | * |
| 12: | * @param string $route |
| 13: | * |
| 14: | * @return int |
| 15: | */ |
| 16: | public function getLayout(string $route): int { |
| 17: | $query = $this->db->query("SELECT * FROM " . DB\_PREFIX . "layout\_route WHERE '" . $this->db->escape($route) . "' LIKE route AND store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY route DESC LIMIT 1"); |
| 18: | |
| 19: | if ($query->num_rows) { |
| 20: | return (int)$query->row['layout_id']; |
| 21: | } else { |
| 22: | return 0; |
| 23: | } |
| 24: | } |
| 25: | |
| 26: | /** |
| 27: | * Get Modules |
| 28: | * |
| 29: | * @param int $layout_id |
| 30: | * @param string $position |
| 31: | * |
| 32: | * @return array<int, array<string, mixed>> |
| 33: | */ |
| 34: | public function getModules(int $layout_id, string $position): array { |
| 35: | $query = $this->db->query("SELECT * FROM " . DB\_PREFIX . "layout\_module WHERE layout\_id = '" . (int)$layout_id . "' AND position = '" . $this->db->escape($position) . "' ORDER BY sort_order"); |
| 36: | |
| 37: | return $query->rows; |
| 38: | } |
| 39: | } |
| 40: | |
OpenCart API API documentation generated by ApiGen dev-master