-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_step5.php
217 lines (186 loc) · 7.66 KB
/
custom_step5.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
if ( isset( $_REQUEST['previous'] ) && $_REQUEST['previous'] ) {
$_REQUEST = $_SESSION[$cat_id]['step5'];
} else if ( isset( $_REQUEST['previous'] ) && !$_REQUEST['previous'] ) {
/* update session step with updated request for previous step*/
$_SESSION[$cat_id]['step4'] = $_REQUEST;
}
if ( !isset($_SESSION[$cat_id]['step5'] ) ) {
$_SESSION[$cat_id]['step5'] = array();
}
/* merge array current, previous and next */
$_REQUEST = array_merge( $_SESSION[$cat_id]['step5'], $_SESSION[$cat_id]['step4'], $_REQUEST );
$card_bg_name = $row['card_bg_path'];
if ( $card_bg_name ) {
$img = BLANK_CARDS . "$card_bg_name";
list($card_width, $card_height, $type, $attr) = getimagesize($img);
$PanWidth = "width:{$card_width}px;";
$PanHeight = "height:{$card_height}px;";
} else {
$PanWidth = 'width:' . ($card_width * 100 + 20) . 'px;';
$PanHeight = 'height:' . ($card_height * 100) . 'px;';
}
/* set variables here */
//var_dump($_REQUEST);
extract($_REQUEST);
$card_settings = unserialize( $row['card_settings'] );
$price = explode( "||", $qty_price );
/* generate create card url params */
$card_url = generate_card_url();
/* set left right widths */
if ( $card_width > 453 ) { // imaeg is wider then the left width
$left_width = $card_width."px";
$right_width = (931 - $card_width)."px";
} else {
$left_width = "453px";
$right_width = "478px";
}
?>
<div class="body_internal_wrapper">
<div class="process_step_wrapp">
<img src="<?php echo siteURL;?>images/envelope_1.png" />
</div>
<!--detail_page_heading-->
<div class="detail_page_heading">
<?php echo $row['cat_title'] . ' : ' . $row['card_title']; ?>
</div><!--detail_page_heading-->
<!--detail_left-->
<div class="detailpage_left" style="width: <?php echo $left_width; ?>">
<div class="detail_left_smallgeading">
<?php echo $row['card_code'] . ' - ' . $row['card_title']; ?>
</div>
<!--detail_big_img-->
<div class="detail_left_smallgeading" style="clear:both;">Envelope</div>
<div id="card_envelop" style="overflow:hidden; position: relative; float:left; background-image:url('<?php echo ENVELOPES . "white.jpg" ; ?>'); background-repeat: no-repeat; width: 450px; height: 337px;">
</div>
<div class="detail_left_smallgeading" style="clear:both;">Invitation</div>
<div id="page_workArea" style="overflow:hidden; position: relative; float:left; background-image:url('<?php echo siteURL . "create_card.php?$card_url"; ?>'); <?php echo $PanWidth . $PanHeight; ?> ">
</div> <!-- page_workArea -->
<!--color_swatch-->
<div class="zoomer_wrapp" style="display: none; visibility: hidden;">
<a href="<?php echo siteURL . 'create_card.php'; ?>" id="card_large_preview"><span><img src="images/zoom.png" /></span> Zoom in</a>
</div>
</div><!--detail_left-->
<!--detail_right-->
<div class="detail_right" style="width: <?php echo $right_width; ?>">
<form name="frm_step5" id="frm_step5" method="post" action="add_to_cart.php">
<?php
foreach($_REQUEST as $key => $val ) {
if ( $key == 'step') {
echo "<input type='hidden' id='step' name='step' value='step6' />\n";
} else {
if ( is_array( $val ) ) {
foreach ($val as $k => $v) {
$v = stripslashes($v);
echo "<input type='hidden' name='{$key}[]' value=\"{$v}\" />\n";
}
} else {
echo "<input type='hidden' id='{$key}' name='{$key}' value='{$val}' />\n";
}
}
}
?>
<input type="hidden" name="total_envelope" id="hd_total_envelope" value="0" />
<input type="hidden" name="total_x_envelope" id="hd_total_x_envelope" value="0" />
<div class="detail_page_innerheading">
Envelope Options
</div>
<div class="detrail_page_desc">
<p>
Envelope options are listed below. Any additional cost, if applicable, is denoted on a per envelope basis.
</p>
<select id="envelop" name="envelop">
<?php echo get_card_envelopes( isset( $envelop ) ? $envelop : NULL ); ?>
</select>
</div>
<?php
if ($mail_option == 'mail_for_me' ) :
$hide_extra_envelopes = "style='display:none;'";
else:
$hide_extra_envelopes = NULL;
endif;
?>
<div class="detail_page_innerheading" <?php echo $hide_extra_envelopes;?>>
Extra Envelopes
</div>
<div class="detrail_page_desc" <?php echo $hide_extra_envelopes;?>>
<p>
You can order extra mailing envelopes in case you make a mistake addressing your cards. Quantity below will include inner envelopes if you selected them.
</p>
<p>Extra Envelope at $<?php echo ONE_ENVELOPE_COST;?> each = $<span id="x_evn_price"></span></p>
<select id="x_envelop" name="x_envelop">
<?php
for( $x = 0; $x <= 50; $x+=5 ) {
$sel = isset( $x_envelop ) && $x_envelop == $x ? ' selected="selected" ' : NULL;
echo "<option value='{$x}' $sel>{$x}</option>";
}
?>
</select>
</div>
<script type="text/javascript">
var validation = null;
jQuery(document).ready(function($){
$(".personalized_btn").live ('click', function() {
return true;
});
$(".personalized_btn_back").live ('click', function() {
$("#previous").val('1');
$("#step").val('step4');
$("#frm_step5").attr("action", '<?php echo siteURL;?>custom.php');
});
$("#envelop").live ('change', function() {
var _val = $("#envelop").val().split('|');
var _url = "url('<?php echo ENVELOPES;?>" + _val[0] + "')";
var _total_qty = "<?php echo (int)$price[1];?>";
var _total_price = parseFloat("<?php echo (int)$price[2];?>");
$("#card_envelop").css( {'background-image' : _url });
if ( _val[1] > 0 ) {
var _envelope_price = parseFloat( _val[1] ) * parseFloat( _total_qty );
$("#hd_total_envelope").val(_envelope_price);
} else {
$("#hd_total_envelope").val('0');
var _envelope_price = "0 (included)";
}
$("#evenlope_price").html(_envelope_price);
$("#x_envelop").trigger('change');
});
$("#envelop").trigger('change');
$("#x_envelop").live('change', function() {
var _x_total = parseFloat( $(this).val() ) * parseFloat(<?php echo ONE_ENVELOPE_COST;?>);
var _env_total = parseFloat( $("#hd_total_envelope").val() );
var _total = parseFloat("<?php echo (float)$price[2];?>");
var _tot_env_x = parseFloat( _env_total ) + parseFloat( _total );
if ( _x_total > 0 ) {
$("#hd_total_x_envelope").val( _x_total );
_tot_env_x = parseFloat( _tot_env_x ) + parseFloat( _x_total );
$("#evenlope_x_price").html("Extra Envelope(s) Charges: <b>$ " + _x_total + "</b> <br/>").show();
} else {
$("#hd_total_x_envelope").val('0');
$("#evenlope_x_price").html("").hide();
}
$("#evenlope_price_total").html(_tot_env_x.toFixed(2));
$("#x_evn_price").html(_x_total);
});
$("#x_envelop").trigger('change');
});
</script>
<div class="personalized_btn_wrapp">
<input name="" type="submit" class="personalized_btn" value="Continue"/>
<input name="" type="submit" class="personalized_btn_back" value="Previous"/>
<div class="personalized_txt">
<?php
echo "Your Price : $ {$price[2]}<br/>";
echo "Quantity: {$price[1]}<br/>";
if($_REQUEST['mail_option']!="address_for_me" && $_REQUEST['return'] !="return") // if PrintingType is not 'addresForMe'AND'return' then let it display guests selected count
{
echo $total_guest_ids ? "{$total_guest_ids} guest(s) selected<br/>" : NULL;
}
?>
Envelope Price: <b>$</b> <span id="evenlope_price" style="font-weight:bold"></span><br/>
<span id="evenlope_x_price" style="margin:5px 0px;display:block"></span>
<!-- Total Price: <b>$</b> <span id="evenlope_price_total" style="font-weight:bold"></span> -->
</div>
</div>
</form>
</div><!--detail_right-->
</div><!--body_internal_wrapp-->