Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 48b04341

Von Jan Büren vor fast 3 Jahren hinzugefügt

  • ID 48b04341b15c68a697bd2d0c3e6ffa8e5594dda3
  • Vorgänger b154cbc6
  • Nachfolger 499b6f5c

Shop:update_part um POD und Beispiel Code erweitert

Unterschiede anzeigen:

SL/ShopConnector/Base.pm
34 34

  
35 35
sub get_new_orders { die 'get_order needs to be implemented' }
36 36

  
37
sub update_part    { die 'update_part needs to be implemented' }
37
sub update_part    {
38
  die 'update_part needs to be implemented';
39

  
40
  my ($self, $shop_part, $todo) = @_;
41
  #shop_part is passed as a param
42
  die "Need a valid Shop Part for updating Part" unless ref($shop_part) eq 'SL::DB::ShopPart';
43
  die "Invalid todo for updating Part"           unless $todo =~ m/(price|stock|price_stock|active|all)/;
44

  
45
  my $part = SL::DB::Part->new(id => $shop_part->part_id)->load;
46
  die "Shop Part but no kivi Part?" unless ref $part eq 'SL::DB::Part';
47

  
48
  my $success;
49

  
50
  return $success ? 1 : 0;
51
}
38 52

  
39 53
sub get_article    { die 'get_article needs to be implemented' }
40 54

  
......
85 99

  
86 100
=item C<get_new_orders>
87 101

  
88
=item C<update_part>
102
=item C<update_part $shop_part $todo>
103

  
104
Updates one Part including all metadata and Images in a Shop.
105
Needs a valid 'SL::DB::ShopPart' as first parameter and a requested action
106
as second parameter. Valid values for the second parameter are
107
"price, stock, price_stock, active, all".
108
The method updates either all metadata or a subset.
109
Name and action for the subsets:
110

  
111
 price       => updates only the price
112
 stock       => updates only the available stock (qty)
113
 price_stock => combines both predecessors
114
 active      => updates only the state of the shop part
115

  
116
Images should always be updated, regardless of the requested action.
117
Returns 1 if all updates were executed successful.
118

  
119

  
89 120

  
90 121
=item C<get_article>
91 122

  

Auch abrufbar als: Unified diff