Revision 509

Date:
2015/08/27 10:19:12
Author:
ahitrov
Revision Log:
1. New object - webshop profile
2. Basket recount uses item price if applicable

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/webshop/lib/webshop/Init.pm

     
    17 17 webshop::SQL::CouponsTable
    18 18 webshop::SQL::CouponLinkTable
    19 19
    20 webshop::Profile
    21
    20 22 webshop::Address
    21 23 webshop::Basket
    22 24 webshop::Order
     
    39 41 ));
    40 42
    41 43 sub init {
    42 push @{ $state->{'available_documents'} }, qw(webshop::Basket webshop::Order webshop::Delivery webshop::Payment webshop::Coupon webshop::Discount webshop::Country webshop::Area webshop::Town);
    44 push @{ $state->{'available_documents'} }, qw(webshop::Basket webshop::Order webshop::Delivery webshop::Payment webshop::Coupon webshop::Discount webshop::Country webshop::Area webshop::Town webshop::Profile);
    43 45 push @{ $state->{'available_sections'} }, qw(webshop::DeliverySection webshop::PaymentSection webshop::RegionSection);
    44 46 push @{ $state->{'available_links'} }, qw(webshop::CouponItemLink webshop::OrderCouponLink);
    45 47 0;
  • utf8/plugins/webshop/lib/webshop/Keeper.pm

     
    206 206 foreach my $item ( @$basket ) {
    207 207 if ( $item->status == 1 ) {
    208 208 $total += $item->number;
    209 $sum += $item->number * $item->price;
    209 if ( exists $item->{item} ) {
    210 $sum += $item->number * $item->{item}->price;
    211 } else {
    212 $sum += $item->number * $item->price;
    213 }
    210 214 }
    211 215 }
    212 216 return ($total, $sum);
  • utf8/plugins/webshop/lib/webshop/Profile.pm

     
    1 package webshop::Profile;
    2
    3 use strict;
    4 use Contenido::Globals;
    5 use base 'Contenido::Document';
    6
    7 sub extra_properties
    8 {
    9 return (
    10 { 'attr' => 'dtime', 'hidden' => 1 },
    11 { 'attr' => 'status', 'type' => 'status',
    12 cases => [
    13 [0, 'Профиль не активен'],
    14 [1, 'Профиль активен'],
    15 ],
    16 },
    17 )
    18 }
    19
    20 sub class_name
    21 {
    22 return 'Настройки веб-магазина';
    23 }
    24
    25 sub class_description
    26 {
    27 return 'Профиль настроек веб-магазина';
    28 }
    29
    30 1;