Skip to content

Commit

Permalink
bring functionality to enable/disable button in shipping methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Grissinger committed May 18, 2016
1 parent 8460145 commit 5ce3426
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
16 changes: 16 additions & 0 deletions controllers/single_page/dashboard/store/settings/shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ public function delete($smID)
$sm->delete();
$this->redirect('/dashboard/store/settings/shipping/removed');
}
public function toggle_status($smID)
{
$sm = StoreShippingMethod::getByID($smID);
if($sm->isEnabled()){
$sm->setEnabled(false);
} else {
$sm->setEnabled(true);
}
$sm->save();
$this->redirect('/dashboard/store/settings/shipping/status_updated');
}
public function success()
{
$this->view();
Expand All @@ -50,6 +61,11 @@ public function removed()
$this->view();
$this->set("message", t("Successfully removed"));
}
public function status_updated()
{
$this->view();
$this->set("message", t("Updated Shipping Method Status"));
}
public function add_method()
{
$data = $this->post();
Expand Down
18 changes: 10 additions & 8 deletions single_pages/dashboard/store/settings/shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@
<td><?=$method->getName()?></td>
<td class="text-right">
<a href="<?=URL::to('/dashboard/store/settings/shipping/edit', $method->getShippingMethodID())?>" class="btn btn-default"><?=t("Edit")?></a>
<?php if ($method->getShippingMethodTypeMethod()->disableEnabled()) {
?>
<a href="" class="btn btn-default"><?=t("Disable")?></a>
<?php
} else {
?>
<a href="<?=URL::to('/dashboard/store/settings/shipping/delete', $method->getShippingMethodID())?>" class="btn btn-danger"><?=t("Delete")?></a>
<a href="<?=URL::to('/dashboard/store/settings/shipping/toggle_status', $method->getShippingMethodID())?>" class="btn btn-default">
<?php if($method->isEnabled()){?>
<?=t("Disable")?>
<?php } else { ?>
<?=t("Enable")?>
<?php } ?>
</a>
<?php if (!$method->getShippingMethodTypeMethod()->disableEnabled()) { ?>
<a href="<?=URL::to('/dashboard/store/settings/shipping/delete', $method->getShippingMethodID())?>" class="btn btn-danger"><?=t("Delete")?></a>
<?php
}
?>
Expand All @@ -132,4 +134,4 @@
</div>

<?php
} ?>
} ?>

0 comments on commit 5ce3426

Please sign in to comment.