sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[ljcom] r12201: LJSUP-12389: Implement shop cart process...

Committer: vtroitsky
LJSUP-12389: Implement shop cart processing
U   trunk/bin/upgrading/en_LJ.dat
U   trunk/cgi-bin/LJ/Pay/Payment/PayItem/SelfPromo.pm
Modified: trunk/bin/upgrading/en_LJ.dat
===================================================================
--- trunk/bin/upgrading/en_LJ.dat	2012-06-29 07:45:27 UTC (rev 12200)
+++ trunk/bin/upgrading/en_LJ.dat	2012-06-29 09:47:26 UTC (rev 12201)
@@ -447,6 +447,10 @@
 [[siteroot]]
 .
 
+commercial.entry.shop_item.name=Commercial promo <a href="[[promotion_url]]">time slot</a>
+
+commercial.entry.shop_item.name.refund=Refund for commercial promo <a href="[[promotion_url]]">time slot</a>
+
 commercial.shop_item.type=Commercial Promo service
 
 comment.delete=Yes
@@ -13720,6 +13724,9 @@
 wallet.widget.history.des.buy|staleness=1
 wallet.widget.history.des.buy=Buy tokens
 
+wallet.widget.history.des.commercial_refund.generic|staleness=1
+wallet.widget.history.des.commercial_refund.generic=CommercialPromo refund
+
 wallet.widget.history.des.donate=Tokens for an <a href="[[url]]">entry</a>
 
 wallet.widget.history.des.order|staleness=1

Modified: trunk/cgi-bin/LJ/Pay/Payment/PayItem/SelfPromo.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Payment/PayItem/SelfPromo.pm	2012-06-29 07:45:27 UTC (rev 12200)
+++ trunk/cgi-bin/LJ/Pay/Payment/PayItem/SelfPromo.pm	2012-06-29 09:47:26 UTC (rev 12201)
@@ -3,6 +3,7 @@
 use warnings;
 
 use LJ::Pay::PromotedObject;
+use LJ::Pay::Promotion;
 
 use base qw( LJ::Pay::Payment::PayItem );
 
@@ -28,7 +29,24 @@
 
 sub get_product_name {
     my ($self, $subitem) = @_;
+    $subitem = $self->get_subitem();
     my $sp_type = $self->get_prop('selfpromo');
+    my $prefix = 'selfpromo';
+
+    # TODO: Refactor and move this later into LJ::Pay::Promotion->new_from_cart_item($self)
+    if ( $subitem && $subitem =~ /^commercial\-(\d+)$/ ) {
+        # Create promotion object here       
+        my $promo = LJ::Pay::Promotion::Commercial->new($1);
+        my $url = "$LJ::SITEROOT/shop/commpromo.bml";
+        if ($promo) {
+            $url = $promo->url();
+        }
+
+        my $type = $self->get_prop('selfpromo_type');
+        my $suffix = ($type && $type eq 'refund' ? '.refund' : '');
+        return LJ::Lang::ml( "commercial.$sp_type.shop_item.name$suffix", 
+                { 'promotion_url' => $url } );
+    }
     return LJ::Lang::ml( "selfpromo.$sp_type.shop_item.name",
         { 'object_url' => $self->get_object_url } );
 }
@@ -41,7 +59,6 @@
 
     my $subitem = $self->get_subitem();
     my $prefix = ( $subitem && $subitem =~ /^commercial/ ? 'commercial' : 'selfpromo'); # Make it better
-    
 
     return {
         'name' => $self->get_product_name,

Tags: dat, ljcom, pm, sunnyman, vtroitsky
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments