Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Яков
idivbanu
Commits
c806f56b
Commit
c806f56b
authored
May 29, 2018
by
Яков
Browse files
test
parent
c8fd5491
Changes
43
Hide whitespace changes
Inline
Side-by-side
apps/arm/config/routing.yml
View file @
c806f56b
discount_phone
:
class
:
sfDoctrineRouteCollection
options
:
model
:
DiscountPhone
module
:
discount_phone
prefix_path
:
/discount_phone
column
:
id
with_wildcard_routes
:
true
discount
:
class
:
sfDoctrineRouteCollection
options
:
model
:
Discount
module
:
discount
prefix_path
:
/discount
column
:
id
with_wildcard_routes
:
true
notification_emails
:
class
:
sfDoctrineRouteCollection
options
:
...
...
apps/arm/modules/basket_order/templates/_form_fieldset_footer.php
View file @
c806f56b
<?php
if
(
!
$form
->
isNew
())
{
$discount
=
Doctrine
::
getTable
(
'DiscountPhone'
)
->
findOneByOrderId
(
$form
->
getObject
()
->
getId
());
$offers
=
$form
->
getObject
()
->
getOffers
();
if
(
count
(
$offers
)
>
0
)
{
?>
<div
class=
"advanced_custom"
>
<?php
if
(
$discount
)
{
?>
<div>
Использована скидка
<?php
echo
$discount
->
getDiscount
()
->
getTitle
()
.
' с '
.
$discount
->
getActiveDiscount
()
.
'%'
?>
</div>
<?php
}
?>
<div
class=
"advanced_custom__h"
>
Товарные предложения
<sup>
<?php
echo
count
(
$offers
);
?>
</sup></div>
<div
class=
"content"
>
<table
width=
"100%"
cellspacing=
"0"
cellpadding=
"0"
>
...
...
@@ -17,7 +25,7 @@ if (!$form->isNew()) {
<?php
$total
=
0
;
foreach
(
$offers
as
$offer
)
{
echo
'<tr align="right"><td align="left">'
.
$offer
[
'Offer'
][
'Translation'
][
'ru'
][
'title'
]
.
'</td><td>'
.
$offer
[
'amount'
]
.
'</td><td>'
.
number_format
(
$offer
[
'
Offer'
][
'price
'
],
0
,
','
,
' '
)
.
' ₽</td><td><nobr>'
.
number_format
(
$offer
[
'price'
],
0
,
','
,
' '
)
.
' ₽</nobr></td></tr>'
;
echo
'<tr align="right"><td align="left">'
.
$offer
[
'Offer'
][
'Translation'
][
'ru'
][
'title'
]
.
'</td><td>'
.
$offer
[
'amount'
]
.
'</td><td>'
.
number_format
(
$offer
[
'
price'
]
/
$offer
[
'amount
'
],
0
,
','
,
' '
)
.
' ₽</td><td><nobr>'
.
number_format
(
$offer
[
'price'
],
0
,
','
,
' '
)
.
' ₽</nobr></td></tr>'
;
$total
+=
$offer
[
'price'
];
}
echo
'<tr class="advanced_custom__tr_divider_top"><td align="right" colspan="4"><nobr><b>Итого: </b>'
.
number_format
(
$total
,
0
,
','
,
' '
)
.
' ₽</nobr></td></tr>'
;
...
...
apps/www/config/factories.yml
View file @
c806f56b
...
...
@@ -21,6 +21,7 @@ all:
class
:
sfSessionStorage
param
:
session_name
:
om
session_cookie_lifetime
:
2592000
routing
:
class
:
sfPatternRouting
param
:
...
...
apps/www/config/routing.yml
View file @
c806f56b
...
...
@@ -8,6 +8,10 @@ homepage:
requirements
:
sf_culture
:
(?:ru|en)
homepage_discount
:
url
:
/:sf_culture/discount/:url/
param
:
{
module
:
main
,
action
:
index
}
search
:
url
:
/:sf_culture/search/
param
:
{
module
:
search
,
action
:
search
}
...
...
@@ -24,6 +28,10 @@ review:
url
:
/:sf_culture/review/
param
:
{
module
:
review
,
action
:
index
}
discount
:
url
:
/:sf_culture/discount/
param
:
{
module
:
discount
,
action
:
index
}
catalog
:
url
:
/:sf_culture/catalog/
param
:
{
module
:
catalog
,
action
:
index
}
...
...
@@ -48,6 +56,10 @@ basket_complete:
url
:
/:sf_culture/basket/complete/
param
:
{
module
:
basket
,
action
:
complete
}
basket_check_discount
:
url
:
/:sf_culture/basket/check_discount/
param
:
{
module
:
discount
,
action
:
check_discount
}
catalog_show_cat
:
url
:
/catalog/:alias/
param
:
{
module
:
catalog
,
action
:
show_cat
}
...
...
@@ -84,6 +96,10 @@ uploader:
url
:
/uploader/
param
:
{
module
:
main
,
action
:
uploader
}
check_discount_term
:
url
:
/check_discount_term/
param
:
{
module
:
discount
,
action
:
check_discount_term
}
page_show
:
url
:
/:sf_culture/:alias/
class
:
sfDoctrineRoute
...
...
apps/www/config/settings.yml
View file @
c806f56b
...
...
@@ -6,7 +6,7 @@ prod:
dev
:
.settings
:
error_reporting
:
<?php echo (E_ALL | E_STRICT)."\n" ?>
web_debug
:
fals
e
web_debug
:
tru
e
cache
:
true
etag
:
false
logging_enabled
:
false
...
...
apps/www/config/view.yml
View file @
c806f56b
...
...
@@ -4,18 +4,18 @@ default:
metas
:
robots
:
'
index,
follow'
stylesheets
:
-
'
fonts.css?deploy=1519103
100
'
-
'
g.css?deploy=1519103
101
'
-
'
p.css?deploy=1519103
104
'
-
'
a.css?deploy=1519103
1
02'
-
'
fonts.css?deploy=1519103
092
'
-
'
g.css?deploy=1519103
094
'
-
'
p.css?deploy=1519103
095
'
-
'
a.css?deploy=15191030
9
2'
-
'
nouislider.css?deploy=1519103100'
javascripts
:
-
'
jquery-2.1.4.min.js?deploy=1519103
100
'
-
'
jquery.plugins.js?deploy=1519103
100
'
-
'
jquery.cycle2.min.js?deploy=1519103
100
'
-
'
jquery.cycle2.swipe.js?deploy=1519103
100
'
-
'
jquery.cycle2.carousel.min.js
?deploy=1519103100
'
-
'
nouislider.js?deploy=1519103
100
'
-
'
init.d.js?deploy=1519103
100
'
-
'
jquery-2.1.4.min.js?deploy=1519103
092
'
-
'
jquery.plugins.js?deploy=1519103
092
'
-
'
jquery.cycle2.min.js?deploy=1519103
092
'
-
'
jquery.cycle2.swipe.js?deploy=1519103
092
'
-
'
jquery.cycle2.carousel.min.js'
-
'
nouislider.js?deploy=1519103
092
'
-
'
init.d.js?deploy=1519103
092
'
has_layout
:
true
layout
:
layout
apps/www/modules/basket/actions/actions.class.php
View file @
c806f56b
...
...
@@ -344,6 +344,30 @@ class basketActions extends sfActions
$this
->
order_form
->
bind
(
$request
->
getParameter
(
$this
->
order_form
->
getName
()));
if
(
$this
->
order_form
->
isValid
()){
$params
=
$request
->
getParameter
(
$this
->
order_form
->
getName
());
$phone
=
$params
[
'phone'
];
if
(
$this
->
getUser
()
->
hasAttribute
(
'active_discount'
)
&&
$this
->
getUser
()
->
getAttribute
(
'active_discount'
)
!=
false
)
{
$date_now
=
new
DateTime
(
'now'
);
$date_limit
=
new
DateTime
(
'now'
);
$date_limit
->
modify
(
'-30 day'
);
$discount
=
Doctrine_Query
::
create
()
->
select
()
->
from
(
'DiscountPhone dp'
)
->
where
(
'dp.phone = ?'
,
$phone
)
->
andWhere
(
'dp.order_id is null'
)
->
andWhere
(
'dp.created_at BETWEEN STR_TO_DATE(\''
.
$date_limit
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\')
AND STR_TO_DATE(\''
.
$date_now
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\')'
)
->
execute
();
if
(
count
(
$discount
)
>
0
)
{
$discount
=
intval
(
$discount
->
getFirst
()
->
getActiveDiscount
());
}
else
{
$discount
=
0
;
}
}
else
{
$discount
=
0
;
}
$order
=
$this
->
order_form
->
save
();
$basket
->
setBasketOrderId
(
$order
->
getId
());
$basket
->
save
();
...
...
@@ -364,22 +388,45 @@ class basketActions extends sfActions
$products
[
'sum'
]
=
0
;
foreach
(
$basket
->
getBasketOffer
()
->
toArray
()
as
$key
=>
$basketOffer
)
foreach
(
$basket
->
getBasketOffer
()
as
$key
=>
$basketOffer
)
{
$offerTranslation
=
Doctrine_Query
::
create
()
->
select
(
'o.*, t.*'
)
->
from
(
'Offer o'
)
->
where
(
'o.id = ?'
,
intval
(
$basketOffer
[
'offer_id'
]
))
->
where
(
'o.id = ?'
,
intval
(
$basketOffer
->
getOfferId
()
))
->
leftJoin
(
'o.Translation t'
)
->
fetchArray
();
if
(
$discount
&&
$offerTranslation
[
0
][
'discount_available'
]
==
1
)
{
$basketOffer
->
setPrice
(
$basketOffer
->
getPrice
()
/
100
*
(
100
-
$discount
));
$basketOffer
->
save
();
}
$products
[
'elem'
][
$key
][
'name'
]
=
$offerTranslation
[
0
][
'Translation'
][
'ru'
][
'title'
];
$products
[
'elem'
][
$key
][
'price'
]
=
intval
(
$basketOffer
[
'price'
])
/
$basketOffer
[
'amount'
];
$products
[
'elem'
][
$key
][
'count'
]
=
$basketOffer
[
'amount'
];
$products
[
'sum'
]
=
$products
[
'sum'
]
+
intval
(
$basketOffer
[
'price'
]);
$products
[
'elem'
][
$key
][
'price'
]
=
number_format
(
intval
(
$basketOffer
->
getPrice
())
/
$basketOffer
->
getAmount
(),
0
,
','
,
' '
);
$products
[
'elem'
][
$key
][
'count'
]
=
$basketOffer
->
getAmount
();
$products
[
'sum'
]
=
$products
[
'sum'
]
+
intval
(
$basketOffer
->
getPrice
());
}
$date_now
=
new
DateTime
(
'now'
);
$date_limit
=
new
DateTime
(
'now'
);
$date_limit
->
modify
(
'-30 day'
);
$phone_discount
=
Doctrine_Query
::
create
()
->
select
()
->
from
(
'DiscountPhone dp'
)
->
where
(
'dp.phone = ?'
,
$this
->
getUser
()
->
getAttribute
(
'phone_number'
))
->
andWhere
(
'dp.order_id is null'
)
->
andWhere
(
'dp.created_at BETWEEN STR_TO_DATE(\''
.
$date_limit
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\') AND STR_TO_DATE(\''
.
$date_now
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\')'
)
->
execute
();
if
(
count
(
$phone_discount
)
>
0
)
{
$phone_discount
=
$phone_discount
->
getFirst
();
$phone_discount
->
setOrderId
(
$order
->
getId
());
$phone_discount
->
save
();
}
$this
->
getUser
()
->
setAttribute
(
'active_discount'
,
false
);
$this
->
getUser
()
->
setAttribute
(
'phone'
,
false
);
$this
->
getUser
()
->
setAttribute
(
'number_of_views'
,
false
);
$emails_dirty
=
NotificationEmailsTable
::
getInstance
()
->
createQuery
(
'e'
)
->
select
(
'e.email'
)
...
...
@@ -420,7 +467,6 @@ class basketActions extends sfActions
);
}
$this
->
redirect
(
'@basket_complete'
);
}
}
...
...
apps/www/modules/basket/actions/components.class.php
View file @
c806f56b
...
...
@@ -24,5 +24,8 @@ class basketComponents extends sfComponents
if
(
count
(
$this
->
offers
)
>
0
){
$this
->
info
=
$user
->
getBasketInfo
();
}
if
(
$this
->
getUser
()
->
hasAttribute
(
'active_discount'
)
&&
$this
->
getUser
()
->
getAttribute
(
'active_discount'
)
!=
false
)
{
$this
->
percent
=
$this
->
getUser
()
->
getAttribute
(
'active_discount'
);
}
}
}
\ No newline at end of file
apps/www/modules/basket/templates/_basket.php
View file @
c806f56b
...
...
@@ -13,12 +13,15 @@
</thead>
<tbody
valign=
"middle"
>
<?php
if
(
!
isset
(
$percent
))
{
$percent
=
false
;
}
$summ
=
0
;
$productFreeShipping
=
1
;
foreach
(
$offers
as
$offer
){
if
(
$offer
[
'Product'
][
'free_shipping'
]
==
0
)
{
$productFreeShipping
=
0
;
}
//print_r($offer);
$quantity_type
=
$offer
[
'Translation'
][
$culture
][
'quantity_type'
];
if
(
$offer
[
'quantity_type_select'
])
{
$quantity_type
=
(
isset
(
Offer
::
$quantity_type_select_values
[
$offer
[
'quantity_type_select'
]])
?
Offer
::
$quantity_type_select_values
[
$offer
[
'quantity_type_select'
]]
:
''
);
...
...
@@ -30,7 +33,7 @@
$offer_img
=
$offer_imgs
[
0
];
}
//print_r($offer['Product']);
echo
'<td valign="top"><a style="border: none" href="/'
.
$offer
[
'Translation'
][
$culture
][
'lang'
]
.
'/product/'
.
$offer
[
'Product'
][
'alias'
]
.
'/"><div class="basket_img" '
.
(
$offer_img
?
'style="background-image: url(/u/i/'
.
Page
::
replaceImageSize
(
$offer_img
,
'S'
)
.
');"'
:
''
)
.
'></div></a>'
;
echo
'<td valign="top"><a style="border: none" href="/'
.
$offer
[
'Translation'
][
$culture
][
'lang'
]
.
'/product/'
.
$offer
[
'Product'
][
'alias'
]
.
'/"><div class="basket_img
'
.
(
$offer
[
'discount_available'
]
==
1
?
'discount'
:
''
)
.
'
" '
.
(
$offer_img
?
'style="background-image: url(/u/i/'
.
Page
::
replaceImageSize
(
$offer_img
,
'S'
)
.
');"'
:
''
)
.
'></div></a>'
;
echo
'<td><div class="basket_offer_title"><a href="/'
.
$offer
[
'Translation'
][
$culture
][
'lang'
]
.
'/product/'
.
$offer
[
'Product'
][
'alias'
]
.
'/">'
.
$offer
[
'Translation'
][
$culture
][
'title'
]
.
'</a></div></td>'
;
echo
'</td>'
;
echo
'<td class="align_center"><div class="product_counter" data-id="'
.
$offer
[
'id'
]
.
'">'
;
...
...
@@ -38,15 +41,22 @@
echo
'<input autocomplete="off" type="text" class="product_counter_val" value="'
.
$offer
[
'BasketOffer'
][
0
][
'amount'
]
.
'" data-symbol="false" onkeyup="counterLite.update($(this))">'
;
echo
'<input type="button" class="product_counter_plus" data-symbol="+" onclick="counterLite.update($(this))">'
;
echo
'</div><span class="name_unit">'
.
(
$quantity_type
!=
''
?
$quantity_type
:
''
)
.
'</span></td>'
;
echo
'<td valign="middle" class="basket_offers_table__price align_center">'
.
number_format
(
$offer
[
'price'
],
0
,
','
,
' '
)
.
' <span class="rub">i</span></td>'
;
echo
'<td valign="middle" class="basket_offers_table__price align_center">'
.
number_format
(
$offer
[
'BasketOffer'
][
0
][
'price'
],
0
,
','
,
' '
)
.
' <span class="rub">i</span></td>'
;
if
(
$percent
&&
$offer
[
'discount_available'
]
==
1
)
{
echo
'<td valign="middle" class="basket_offers_table__price align_center"><div style="position: relative"><div class="basket_discount"><span style="text-decoration: line-through">'
.
number_format
(
$offer
[
'price'
],
0
,
','
,
' '
)
.
' </span><span style="font-size: 15px" class="rub">i</span></div><div class="basket_item">'
.
number_format
(
$offer
[
'price'
]
/
100
*
(
100
-
$percent
),
0
,
','
,
' '
)
.
' <span class="rub">i</span></div></div></td>'
;
echo
'<td valign="middle" class="basket_offers_table__price align_center"><div class="basket_item"> '
.
number_format
(
$offer
[
'BasketOffer'
][
0
][
'price'
]
/
100
*
(
100
-
$percent
),
0
,
','
,
' '
)
.
' <span class="rub">i</span></div></td>'
;
$summ
=
$summ
+
$offer
[
'BasketOffer'
][
0
][
'price'
]
/
100
*
(
100
-
$percent
);
}
else
{
echo
'<td valign="middle" class="basket_offers_table__price align_center"><div class="basket_item">'
.
number_format
(
$offer
[
'price'
],
0
,
','
,
' '
)
.
' <span class="rub">i</span></div></td>'
;
echo
'<td valign="middle" class="basket_offers_table__price align_center"><div class="basket_item">'
.
number_format
(
$offer
[
'BasketOffer'
][
0
][
'price'
],
0
,
','
,
' '
)
.
' <span class="rub">i</span></div></td>'
;
$summ
=
$summ
+
$offer
[
'BasketOffer'
][
0
][
'price'
];
}
echo
'<td width="1" align="center"><div class="basket_clean" onclick="basket.delete(this);"></div></td>'
;
echo
'</tr>'
;
}
?>
</tbody>
</table>
<div
class=
"basket_total"
data-delivery-info=
"
<?php
echo
$productFreeShipping
?>
"
>
<?php
echo
__
(
'Итого'
);
?>
:
<div
class=
"basket_total__price"
>
<?php
echo
number_format
(
$
info
[
'price'
]
,
0
,
','
,
' '
);
?>
</div>
<span
class=
"rub"
>
i
</span></div>
<div
class=
"basket_total"
data-delivery-info=
"
<?php
echo
$productFreeShipping
?>
"
>
<?php
echo
__
(
'Итого'
);
?>
:
<div
class=
"basket_total__price"
>
<?php
echo
number_format
(
$
summ
,
0
,
','
,
' '
);
?>
</div>
<span
class=
"rub"
>
i
</span></div>
</div>
</div>
...
...
apps/www/modules/basket/templates/indexSuccess.php
View file @
c806f56b
...
...
@@ -42,7 +42,7 @@ echo '<h1 class="content_title">' . __('Корзина') . '</h1>';
<?php
echo
'<h2>'
.
__
(
'Контактные данные'
)
.
':</h2>'
;
echo
'<div class="basket_buyer__item"><input size="27" maxlength="255" required="1" placeholder="Как к вам обращаться" onchange="form_validator.check($(this))" onkeyup="form_validator.check($(this))" data-check-rule="noempty" class="basket_buyer__inp_name validate_it" name="basket_order[username]" id="basket_order_username" type="text"></div>'
;
echo
'<div class="basket_buyer__item"><input size="27" maxlength="24" required="1" placeholder="Номер телефона" onchange="form_validator.check($(this))" onkeyup="form_validator.check($(this))" data-check-rule="phone" class="basket_buyer__inp_name validate_it" name="basket_order[phone]" id="basket_order_phone" type="text"></div>'
;
echo
'<div class="basket_buyer__item"><
div class="phone_info"></div><
input size="27" maxlength="24" required="1" placeholder="Номер телефона" onchange="form_validator.check($(this))" onkeyup="form_validator.check($(this))" data-check-rule="phone" class="basket_buyer__inp_name
phone_mask
validate_it" name="basket_order[phone]" id="basket_order_phone" type="text"></div>'
;
echo
'<div class="basket_buyer__item"><input size="27" maxlength="24" required="1" placeholder="Email" onchange="form_validator.check($(this))" onkeyup="form_validator.check($(this))" data-check-rule="email" class="basket_buyer__inp_name validate_it" name="basket_order[email]" id="basket_order_email" type="text"></div>'
;
?>
</div>
...
...
@@ -86,11 +86,126 @@ echo '<h1 class="content_title">' . __('Корзина') . '</h1>';
<?php
echo
'<h2>'
.
__
(
'Общая сумма заказа'
)
.
'</h2>'
;
echo
'<div class="basket_order__price">'
.
$info
[
'priceText'
]
.
' <span class="rub">i</span></div>'
;
echo
'<input type="submit" class="btn green_b_btn order_btn btn_disabled" value="'
.
__
(
'Оформить заказ'
)
.
'"
onclick="yaCounter48466937.reachGoal(\'ORDER\')"
disabled>'
;
echo
'<input type="submit" class="btn green_b_btn order_btn btn_disabled" value="'
.
__
(
'Оформить заказ'
)
.
'" disabled>'
;
?>
</div>
<script
type=
"text/javascript"
>
var
lastvalue
=
''
;
var
lastvalueunmask
=
''
;
function
mask
(
str
)
{
var
arr
=
str
.
split
(
''
);
if
(
str
.
length
>=
2
)
{
arr
.
splice
(
2
,
0
,
"
(
"
);
if
(
str
.
length
>=
5
)
{
arr
.
splice
(
6
,
0
,
"
)
"
);
}
if
(
str
.
length
>=
8
)
{
arr
.
splice
(
10
,
0
,
"
-
"
);
}
if
(
str
.
length
>=
10
)
{
arr
.
splice
(
13
,
0
,
"
-
"
);
}
}
return
arr
.
join
(
''
);
}
function
unmask
(
str
)
{
var
rep
=
/
[
()
\-\s]
/g
;
var
value
=
str
.
replace
(
rep
,
''
);
return
value
;
}
$
(
'
.phone_mask
'
).
on
(
'
input
'
,
function
()
{
var
value
=
unmask
(
$
(
this
).
val
());
var
last
=
value
.
slice
(
-
1
);
var
first
=
value
.
charAt
(
0
);
var
rep
=
/
(
^
\+
7
)(
9
)([
0-9
]{0,9})
/g
;
if
((
value
.
length
==
2
)
&&
(
first
==
'
+
'
))
{
if
(
value
==
'
+9
'
)
{
value
=
'
+79
'
;
lastvalue
=
'
+79
'
;
}
else
{
value
=
'
+7
'
;
lastvalue
=
'
+7
'
;
}
}
else
if
((
value
==
'
7
'
)
||
(
value
==
'
8
'
))
{
value
=
'
+7
'
;
}
else
if
(
value
==
'
9
'
)
{
value
=
'
+79
'
;
}
else
{
var
execval
=
rep
.
exec
(
value
);
if
(
execval
!=
null
)
{
value
=
execval
[
0
];
}
else
{
if
((
last
!=
'
9
'
))
{
value
=
value
.
substring
(
0
,
value
.
length
-
1
)
}
}
}
$
(
this
).
val
(
mask
(
value
));
lastvalue
=
$
(
this
).
val
();
lastvalueunmask
=
value
;
});
$
(
'
.phone_mask
'
).
on
(
'
keydown
'
,
function
(
event
)
{
var
key
=
event
.
keyCode
||
event
.
charCode
;
if
(
key
==
8
||
key
==
46
){
var
value
=
unmask
(
$
(
'
.phone_mask
'
).
val
());
value
=
value
.
substring
(
0
,
value
.
length
-
1
);
$
(
'
.phone_mask
'
).
val
(
mask
(
value
));
lastvalue
=
$
(
'
.phone_mask
'
).
val
();
return
false
;
}
});
$
(
'
.phone_mask
'
).
on
(
'
blur
'
,
function
(
e
)
{
if
(
$
(
'
.phone_mask
'
).
val
().
length
==
18
)
{
$
.
ajax
({
url
:
'
/ru/basket/check_discount/
'
,
dataType
:
'
json
'
,
type
:
'
post
'
,
data
:
{
phone
:
$
(
'
.phone_mask
'
).
val
()},
success
:
function
(
data
)
{
if
(
data
.
status
==
'
success
'
&&
data
.
active_discount
>
0
)
{
$
(
'
.basket_refresh
'
).
html
(
data
.
body
);
$
(
$
(
'
.top_right
'
)[
1
]).
addClass
(
'
discount_basket
'
);
$
(
'
.phone_info
'
).
html
(
'
На этом номере обнаружена скидка
'
+
data
.
active_discount
+
'
%
'
)
}
else
if
(
data
.
status
==
'
success
'
&&
data
.
active_discount
==
0
)
{
$
(
'
.basket_refresh
'
).
html
(
data
.
body
);
$
(
$
(
'
.top_right
'
)[
1
]).
removeClass
(
'
discount_basket
'
);
$
(
'
.phone_info
'
).
html
(
'
На этом номере скидка не обнаружена
'
)
}
},
error
:
function
(
error
)
{
console
.
log
(
error
);
}
})
}
})
$
(
document
).
ready
(
function
()
{
var
delivery_info
=
$
(
'
.basket_total
'
).
data
(
'
delivery-info
'
);
console
.
log
(
delivery_info
);
...
...
apps/www/modules/catalog/actions/actions.class.php
View file @
c806f56b
...
...
@@ -141,7 +141,7 @@ class catalogActions extends sfActions
->
orderBy
(
'p.sort asc'
);
//->andWhere("CHAR_LENGTH(p.product_img) > 0");
$products_q
=
Doctrine_Query
::
create
()
->
select
(
"p.id, p.alias, p.product_img, p.is_detail, p.offer_count, p.is_delete, c.*, t.id, t.lang, t.title, o.id, o.product_id, o.price, o.quantity_type_select, ot.*, ppv.*"
)
->
select
(
"p.id, p.alias, p.product_img, p.is_detail, p.offer_count, p.is_delete, c.*, t.id, t.lang, t.title, o.id, o.product_id, o.price, o.quantity_type_select,
o.discount_available,
ot.*, ppv.*"
)
->
from
(
"Product p"
)
->
leftJoin
(
"p.CatProduct c"
)
->
leftJoin
(
"p.Translation t"
)
...
...
apps/www/modules/catalog/templates/_product_calculator.php
View file @
c806f56b
...
...
@@ -86,7 +86,7 @@
<tr>
<td
colspan=
"5"
>
<i
class=
"br40"
></i>
<a
href=
""
class=
"btn green_btn calculator_table__btn"
onclick=
"yaCounter48466937.reachGoal('ADD');"
>
Добавить в корзину
</a>
<a
href=
""
class=
"btn green_btn calculator_table__btn"
>
Добавить в корзину
</a>
</td>
</tr>
</tbody>
...
...
apps/www/modules/catalog/templates/showSuccess.php
View file @
c806f56b
...
...
@@ -50,3 +50,11 @@ echo '<h1 class="content_title">' . $translation[$culture]['title'] . '</h1>';
}
?>
</div>
<script>
$
(
'
.discount_available
'
).
on
(
'
click
'
,
function
(
e
)
{
if
(
$
(
window
).
width
()
<
650
)
{
$
(
this
).
toggleClass
(
'
show
'
);
}
})
</script>
apps/www/modules/main/actions/actions.class.php
View file @
c806f56b
...
...
@@ -17,7 +17,6 @@ class mainActions extends sfActions
*/
public
function
executeIndex
(
sfWebRequest
$request
)
{
/**/
$this
->
setLayout
(
'layoutHome'
);
$this
->
video
=
Doctrine_Query
::
create
()
->
select
(
"v.*, t.*"
)
...
...
@@ -62,6 +61,7 @@ class mainActions extends sfActions
->
andWhere
(
"c.is_main = 1"
)
->
orderBy
(
"RAND()"
)
->
fetchOne
();
}
public
function
executeDl
(
sfWebRequest
$request
)
{
...
...
apps/www/modules/main/templates/indexSuccess.php
View file @
c806f56b
<table
class=
"lending"
style=
"width: 100%"
cellspacing=
"0"
cellpadding=
"0"
>
<tr>
<td>
...
...
apps/www/modules/product/actions/actions.class.php
View file @
c806f56b
...
...
@@ -56,5 +56,41 @@ class productActions extends sfActions
$this
->
setLayout
(
'layoutPage'
);
if
(
$this
->
getUser
()
->
hasAttribute
(
'number_of_views'
)
&&
$this
->
getUser
()
->
getAttribute
(
'number_of_views'
)
!=
false
)
{
$number_of_view
=
$this
->
getUser
()
->
getAttribute
(
'number_of_views'
);
if
(
$this
->
getUser
()
->
getAttribute
(
'number_of_views'
)
<
10
)
{
if
(
!
$this
->
getUser
()
->
hasAttribute
(
'ids_view_product'
)
||
$this
->
getUser
()
->
getAttribute
(
'ids_view_product'
)
==
false
)
{
$this
->
getUser
()
->
setAttribute
(
'ids_view_product'
,
$this
->
product
[
'id'
]
.
';'
);
}
else
{
$str_ids
=
$this
->
getUser
()
->
getAttribute
(
'ids_view_product'
);
$ids
=
explode
(
';'
,
$str_ids
);
if
(
!
in_array
(
$this
->
product
[
'id'
],
$ids
))
{
$number_of_view
++
;
$this
->
getUser
()
->
setAttribute
(
'number_of_views'
,
$number_of_view
);
$this
->
getUser
()
->
setAttribute
(
'ids_view_product'
,
$str_ids
.
$this
->
product
[
'id'
]
.
';'
);
}
}
}
if
(
$number_of_view
==
5
||
$number_of_view
==
7
||
$number_of_view
==
10
)
{
if
(
$this
->
getUser
()
->
hasAttribute
(
'phone_number'
)
&&
$this
->
getUser
()
->
getAttribute
(
'phone_number'
)
!=
false
)
{
$date_now
=
new
DateTime
(
'now'
);
$date_limit
=
new
DateTime
(
'now'
);
$date_limit
->
modify
(
'-30 day'
);
$phone_discount
=
Doctrine_Query
::
create
()
->
select
()
->
from
(
'DiscountPhone dp'
)
->
where
(
'dp.phone = ?'
,
$this
->
getUser
()
->
getAttribute
(
'phone_number'
))
->
andWhere
(
'dp.order_id is null'
)
->
andWhere
(
'dp.created_at BETWEEN STR_TO_DATE(\''
.
$date_limit
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\') AND STR_TO_DATE(\''
.
$date_now
->
format
(
'Y-m-d H:i:s'
)
.
'\', \'%Y-%m-%d %H:%i:%s\')'
)
->
execute
();
if
(
count
(
$phone_discount
)
>
0
)
{
$phone_discount
=
$phone_discount
->
getFirst
();
$phone_discount
->
setActiveDiscount
(
$number_of_view
);
$phone_discount
->
save
();
$this
->
getUser
()
->
setAttribute
(
'active_discount'
,
$number_of_view
);
}
}
}
}
}
}
apps/www/modules/product/templates/_product.php
View file @
c806f56b
...
...
@@ -3,14 +3,24 @@ if (isset($product)) {
$translation
=
$product
[
'Translation'
];
$productImg
=
explode
(
';'
,
$product
[
'product_img'
]);
$productImg
=
(
count
(
$productImg
)
>
0
?
$productImg
[
0
]
:
false
);
echo
'<div class="catalog_category_child_item">'
;
$q
=
Doctrine
::
getTable
(
'Product'
)
->
findOneById
(
$product
[
'id'
])
->
getOffer
();
$discount_available
=
false
;
foreach
(
$q
as
$offer
)
{
if
(
$offer
->
getDiscountAvailable
()
==
1
)
{
$discount_available
=
true
;
break
;
}
}
echo
'<div class="catalog_category_child_item '
.
(
$discount_available
?
'discount'
:
''
)
.
'">'
;
if
(
$discount_available
)
{
echo
'<div class="discount_available"><div class="discount_available_desc">Ищите наши QR-коды в видео и соц. сетях и забирайте скидку</div><div class="discount_available_title">Доступен со скидкой</div></div>'
;
}
echo
'<'
.
(
$product
[
'is_detail'
]
?
'a'
:
'span'
)
.
' href="'
.
url_for
(
"@product_show?alias="
.
$product
[
'alias'
])
.
'" class="anb">'
;
if
(
$productImg
){
echo
'<img src="/i/n.gif" style="background-image: url(/u/i/'
.
Page
::
replaceImageSize
(
$productImg
,
'S'
)
.
');" />'
;
}
else
{
$offerImg
=
''
;
$q
=
Doctrine
::
getTable
(
'Product'
)
->
findOneById
(
$product
[
'id'
])
->
getOffer
();
foreach
(
$q
as
$offer
)
{
if
(
strlen
(
$offer
->
getImg
())
>
3
)
$offerImg
=
$offer
->
getImg
();
...
...
apps/www/modules/product/templates/showSuccess.php
View file @
c806f56b
...
...
@@ -115,7 +115,7 @@ $view = 'much';
<input
data-initialized=
"1"
data-id=
"
<?php
echo
$offer
[
'id'
];
?>
"
type=
"radio"
name=
"offer"
onchange=
"counterLite.change($(this))"
>
<?php
if
(
$offer
[
'price'
]
>
1
)
{
?>
<table
width=
"100%"
cellpadding=
"0"
cellspacing=
"0"
>
<tr>
<tr
<?php
echo
(
$offer
[
'discount_available'
]
==
1
?
'class="discount'
:
''
)
?>
"
>
<td>
<?php
echo
$offer
[
'title'
]
.
$quantity_type
;
?>
</td>
<td
style=
"white-space: nowrap;"
align=
"right"
>
<?php
echo
$offer_str
;
?>
...
...
@@ -125,7 +125,7 @@ $view = 'much';
<div
class=
"product_counter min"
data-id=
"
<?php
echo
$offer
[
'id'
];
?>
"
data-price=
"
<?php
echo
$offer
[
'price'
];
?>
"
>
<input
type=
"button"
class=
"product_counter_minus"
data-symbol=
"-"
onclick=
"counterLite.update($(this))"
>
<input
autocomplete=
"off"
type=
"text"
class=
"product_counter_val"
value=
"
<?php
echo
(
$infoAmount
?
$infoAmount
:
0
)
?>
"
data-symbol=
"-+"
onkeyup=
"counterLite.update($(this))"
>
<input
type=
"button"
class=
"product_counter_plus"
data-symbol=
"+"
onclick=
"counterLite.update($(this))
; yaCounter48466937.reachGoal('ADD');
"
>
<input
type=
"button"
class=
"product_counter_plus"
data-symbol=
"+"
onclick=
"counterLite.update($(this))"
>
</div>
</td>
</tr>
...
...
apps/www/templates/header.php
View file @
c806f56b
...
...
@@ -11,7 +11,7 @@
?>
<title>
<?php
include_slot
(
'title'
,
sfConfig
::
get
(
'app_www_title'
));
?>
</title>
</head>
<body>
<body
<?php
echo
(
$sf_request
->
hasParameter
(
'url'
)
?
'class="scroll_hidden overlay_discount_active"'
:
''
)
?>
>
<script
type=
"text/javascript"
>
var
culture
=
'
<?php
echo
$sf_user
->
getCulture
();
?>
'
;
</script>
\ No newline at end of file
apps/www/templates/layout.php
View file @
c806f56b
...
...
@@ -14,4 +14,5 @@
</table>
<?php
include
(
sfConfig
::
get
(
'sf_app_template_dir'
)
.
'/bottom.php'
);
?>
<?php
include
(
sfConfig
::
get
(
'sf_app_template_dir'
)
.
'/footer.php'
);
?>
\ No newline at end of file
<?php
include
(
sfConfig
::
get
(
'sf_app_template_dir'
)
.
'/footer.php'
);
?>
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment