Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

search on name and description.

upgrade db, delete field table product.p_name, url for image generated from p_id
Signed-off-by:d1ffuz0r <ап@10.65.197.35>
  • Loading branch information...
commit 62428dd55d636785c98266dcfbc49a48ce655b80 1 parent ac1ee33
d1ffuz0r authored
View
8 application/classes/model/main.php
@@ -72,8 +72,8 @@ public function get_services()
public function get_fisttwo()
{
- $_sql = "select * from product where p_name = 'mouse1' union
- select * from product where p_name = 'keyboard1'";
+ $_sql = "( SELECT * FROM product WHERE p_category = 'mouse' ORDER BY RAND() LIMIT 1)
+ UNION ( SELECT * FROM product WHERE p_category = 'keyboard' ORDER BY RAND() LIMIT 1)";
$this->_firstprod = DB::query(Database::SELECT, $_sql)
->as_object()
->execute();
@@ -82,8 +82,8 @@ public function get_fisttwo()
public function get_threefour()
{
- $_sql = "select * from product where p_name = 'nb_acessory1' union
- select * from product where p_name = 'monitors1'";
+ $_sql = "( SELECT * FROM product WHERE p_category = 'nb_acessory' ORDER BY RAND() LIMIT 1)
+ UNION ( SELECT * FROM product WHERE p_category = 'monitors' ORDER BY RAND() LIMIT 1)";
$this->_twoprod = DB::query(Database::SELECT, $_sql)
->as_object()
->execute();
View
1  application/classes/model/shop.php
@@ -144,6 +144,7 @@ public function search($searchQuery)
$this->_search = DB::select()
->from('product')
->where('p_desc', 'like', '%' . $searchQuery['search_q'] . '%')
+ ->or_where('p_rusname', 'like', '%' . $searchQuery['search_q'] . '%')
->as_object()
->execute();
return $this->_search;
View
6 application/views/page/index.php
@@ -94,13 +94,13 @@ function manageControls(position){
<span class="green"><?php echo round($desk->p_price)?> руб</span><br/>
</div>
</td>
-<td class="page_center_img"><img align="right" src="<?php echo Kohana::$base_url;?>img/<?php echo $desk->p_category ?>/<?php echo $desk->p_name ?>.png" alt="" /> </td>
+<td class="page_center_img"><img align="right" src="<?php echo Kohana::$base_url;?>img/<?php echo $desk->p_category ?>/<?php echo $desk->p_id ?>.png" alt="" /> </td>
<? } ?>
</tr>
<tr>
<? foreach($prowthree as $desk):?>
<td class="page_center_button">
- <a class="page_center_buy" <? if(Cookie::get('loged_in') == TRUE) { ?> href="/shop/new_order/<?php echo $desk->p_id ?>" title="Оформить заказ"><? } ?>></a>
+ <a class="page_center_buy" <? if(Cookie::get('loged_in') == TRUE) { ?> href="/shop/new_order/<?php echo $desk->p_id ?>" title="Оформить заказ"><? } ?></a>
<a class="page_center_info" href="/view/product/<?php echo $desk->p_id ?>" title="Просмотр"><span>more-info</span></a>
</td>
<td class="page_center_content">
@@ -112,7 +112,7 @@ function manageControls(position){
<span class="green"><?php echo round($desk->p_price)?> руб</span><br/>
</div>
</td>
-<td class="page_center_img"><img align="right" src="<?php echo Kohana::$base_url;?>img/<?php echo $desk->p_category ?>/<?php echo $desk->p_name ?>.png" alt="" /> </td>
+<td class="page_center_img"><img align="right" src="<?php echo Kohana::$base_url;?>img/<?php echo $desk->p_category ?>/<?php echo $desk->p_id ?>.png" alt="" /> </td>
<? endforeach; ?>
</tr>
</table>
View
8 application/views/page/view/cat.php
@@ -1,16 +1,16 @@
-<center><?php echo $pagination?></center>
+<center><?php echo $pagination ?></center>
<hr>
<table width="100%">
-<? foreach($id as $desk):?>
+<? foreach($id as $desk): ?>
<tr>
<h1><?=$desk->p_rusname ?></h1>
-<h2>Описание: <?=$desk->p_desc ?></h2><img src="<?php echo Kohana::$base_url;?>img/<?php echo $desk->p_category ?>/<?php echo $desk->p_name ?>.png" alt="" />
+<h2>Описание: <?=$desk->p_desc ?></h2><img src="<?php echo Kohana::$base_url;?>img/<?php echo $desk->p_category ?>/<?php echo $desk->p_id ?>.png" alt="" />
<h2 style="color:red;">Цена: <?php echo round($desk->p_ndsprice)?> руб | <?=round($desk->p_kursprice,2);?> $</h2>
<h3 align="right"><a href="/view/product/<?php echo $desk->p_id ?>">просмотр</a><? if(Cookie::get('loged_in') == TRUE) { ?> | <a href="/shop/new_order/<?php echo $desk->p_id ?>">оформить заказ</a><? } ?></h3>
</tr>
<hr>
<? endforeach; ?>
</table>
-<center><?php echo $pagination?></center>
+<center><?php echo $pagination ?></center>
<hr>
<p align="right" style="color: red;">цены с учётом ндс</p>
View
4 application/views/page/view/product.php
@@ -1,8 +1,8 @@
<table width="100%">
-<? foreach($id as $desk):?>
+<? foreach($id as $desk): ?>
<tr height="152">
<h1><?=$desk->p_rusname ?></h1>
-<h2>Описание: <?=$desk->p_desc ?></h2><img src="<?=Kohana::$base_url;?>img/<?=$desk->p_category ?>/<?=$desk->p_name ?>.png" alt="" />
+<h2>Описание: <?=$desk->p_desc ?></h2><img src="<?=Kohana::$base_url;?>img/<?=$desk->p_category ?>/<?=$desk->p_id ?>.png" alt="" />
<h2 style="color:red;">Цена: <?=round($desk->p_ndsprice)?> руб | <?=round($desk->p_kursprice,2);?> $</h2><h2 align="right"><? if(Cookie::get('loged_in') == TRUE) { ?><a href="/shop/new_order/<?=$desk->p_id ?>">оформить заказ</a><? } ?></h2>
</tr>
<? endforeach; ?>
Please sign in to comment.
Something went wrong with that request. Please try again.