Share
Embed
Annual Pro sale · Save $30
Have presentations of your own?
Share with private links, password protection, and more control over your work.
Transcript
37 slides
-
EC-CUBE3ʹ͍ͭͯ • http://www.ec-cube.net/download/ ࠷৽ͷEC-CUBE3Λμϯϩʔυ • Macͷํͪ͜Β http://amidaike.hatenablog.com/entry/ 2015/07/02/015914 • Windowsͷํͪ͜Β
http://qiita.com/chihiro-adachi/items/ 5fb2175454d3bfa047ac -
EC-CUBE3ʹ͍ͭͯ σΟϨΫτϦ໊ ػೳ໊ EccubeԼ ϕʔεͱͳΔApplication.php͕ଘࡏ͠ɺඞ ͣ͜ͷΫϥε͔Β࣮ߦ͞ΕΔ Application Application.phpͷΫϥεϑΝΠϧ͕֨ೲ Command ConsoleίϚϯυ༻Ϋϥε
Common ఆఆٛΫϥε Controller ίϯτϩʔϥʔΫϥε ControllerProvider URLϚοϐϯάఆٛؔ Doctrine Doctirine֦ுΫϥε Entity DB࿈ܞ༻EntityΫϥε Event FormΠϕϯτ༻Ϋϥε EventListner ΠϕϯτϦεφʔ༻Ϋϥε -
EC-CUBE3ʹ͍ͭͯ σΟϨΫτϦ໊ ػೳ໊ Exception ۀΤϥʔΫϥε Form FormλΠϓΫϥε Plugin ϓϥάΠϯ༻ManagerΫϥε Repository
DBΞΫηε༻ϦϙδτϦΫϥε Resource doctrine༻dcmϑΝΠϧtwigϑΝΠϧ Security ύεϫʔυϋογϡ༻Ϋϥε Service αʔϏεΫϥε ServiceProvider DIఆٛ༻Ϋϥε Twig Twig֦ு༻Ϋϥε Util ڞ௨ؔΫϥε -
EC-CUBE3ʹ͍ͭͯ • ຊମଆͷ؆୯ͳ։ൃͷྲྀΕҎԼͷ௨Γ 1. Controller࡞ 2. ControllerProviderServiceProviderʹඞཁͳఆٛΛՃ 3. TwigϑΝΠϧ࡞ 4.
FormType࡞ 5. ඞཁͰ͋ΕEntityΛ࡞ 6. ը໘֬ೝ -
ϓϥάΠϯͷ֓ཁ • ϓϥάΠϯઆ໌ϖʔδ http://www.ec-cube.net/plugin/ • ϓϥάΠϯͷࢿྉ http://downloads.ec-cube.net/src/manual/v3/ plugin.pdf • αϯϓϧϓϥάΠϯ
https://github.com/EC-CUBE/category-content-plugin -
ϓϥάΠϯΛ࡞ͬͯΈΑ͏ 1. config.ymlͷهड़ํ๏ 2. event.ymlͷهड़ํ๏ 3. PluginManagerͷهड़ํ๏ 4. Eventͷهड़ํ๏ 5.
ServiceProviderͷهड़ํ๏ 6. ຊମʹ߹ΘͤͨσΟϨΫτϦߏ 7. ϓϥάΠϯ༻ཧը໘ͷ࡞ํ๏ 8. طଘը໘ͷFormʹ߲ΛՃ͢Δํ๏ 9. ཧը໘ʹϝχϡʔΛՃ͢Δํ๏(࣍ճػձ͕͋Ε͓ݟͤ͠·͢) -
config.yml name: GiftWrappingϓϥάΠϯ ※ඞਢ code: GiftWrapping ※ඞਢ version: 1.0.0 ※ඞਢ
service: - GiftWrappingServiceProvider orm.path: - /Resource/doctrine ※ϓϥάΠϯͰՃͨ͠ςʔϒϧΛ࡞͢Δ߹ɺorm.pathͷهड़ඞਢ event: GiftWrappingEvent ※eventΛՃ͢Δ߹ɺeventͷهड़ඞਢ form: - onPreSubmit: SampleForm ※FormΠϕϯτΛ֦ு͢Δ߹ɺformͷهड़ඞਢ ·ͨɺඞཁͰ͋Ε const: HOGE: 1 HOGEHOGE: 2 ͱఆهड़Մೳɺୠ͠ݱόʔδϣϯͩͱϓϥάΠϯ͕ແޮͷ߹ɺ͜ͷఆ͕ಡΈࠐΊͳ͍ -
event.yml eccube.event.render.shopping.before: - [onRenderGiftWrappingShoppingBefore, NORMAL] eccube.event.render.admin_setting_shop_payment_edit.before: - [onRenderGiftWrappingAdminPaymentBefore, NORMAL] Πϕϯτͷछྨʹ
ΞϓϦέʔγϣϯશମͷϑοΫϙΠϯτ eccube.event.app.{before | after} ίϯτϩʔϥʔΠϕϯτͷϑοΫϙΠϯτ eccube.event.controller.{ϧʔςΟϯά໊}.{before | after | finish} ϨϯμʔΠϕϯτͷϑοΫϙΠϯτ eccube.event.render.{ϧʔςΟϯά໊}.before -
ϧʔςΟϯάͷ֬ೝํ๏ $ php app/console router:debug +----------------------------------------+-----------------------------------------------------------+---------+ | Name | Path
| Pattern | +----------------------------------------+-----------------------------------------------------------+---------+ | admin_logout | /admin/logout | GET | | admin_login_check | /admin/login_check | | | logout | /logout | GET | | login_check | /login_check | | | user_data | /user_data/{route} | ANY | | homepage | / | ANY | | top | / | ANY | | index | / | ANY | | block | /block | ANY | | cart | /cart | ANY | | cart_add | /cart/add | POST | | cart_up | /cart/up/{productClassId} | ANY | | cart_down | /cart/down/{productClassId} | ANY | | cart_set_quantity | /cart/setQuantity/{productClassId}/{quantity} | ANY | | cart_remove | /cart/remove/{productClassId} | ANY | | cart_buystep | /cart/buystep | ANY | | contact | /contact | ANY | | contact_complete | /contact/complete | ANY | | entry | /entry | ANY | | entry_complete | /entry/complete | ANY | | entry_activate | /entry/activate/{secret_key} | ANY | | forgot | /forgot | ANY | | forgot_reset | /forgot/reset/{reset_key} | ANY | | block_category | /block/category | ANY | | block_cart | /block/cart | ANY | | block_search_product | /block/search_product | ANY | | block_news | /block/news | ANY | | block_login | /block/login | ANY | | help_about | /help/about | ANY | | help_guide | /help/guide | ANY | | help_privacy | /help/privacy | ANY | | help_tradelaw | /help/tradelaw | ANY | | help_agreement | /help/agreement | ANY | -
PluginManagerͷهड़ <?php namespace Plugin\PayPalExpress; class PluginManager extends AbstractPluginManager { public
function install($config, $app) { $this->migrationSchema($app, __DIR__ . '/Resource/doctrine/migration', $config['code']); } public function uninstall($config, $app) { $this->migrationSchema($app, __DIR__ . '/Resource/doctrine/migration', $config['code'], 0); } public function enable($config, $app) { } public function disable($config, $app) { } public function update($config, $app) { } } -
Eventͷهड़ <?php namespace Plugin\GiftWrapping; class GiftWrappingEvent { private $app; public
function __construct($app) { $this->app = $app; } /** * ߪೖը໘ʹϥοϐϯά߲Λදࣔ * * @param FilterResponseEvent $event */ public function onRenderGiftWrappingShoppingBefore(FilterResponseEvent $event) { $request = $event->getRequest(); $response = $event->getResponse(); $Wrapping = $this->app['eccube.plugin.repository.wrapping']->find(1); if ($Wrapping->getIsWrapping()) { $html = $this->getHtmlWrapping($request, $response); $response->setContent($html); } $event->setResponse($response); } /** * * @param Request $request -
ServiceProviderͷهड़ <?php namespace Plugin\GiftWrapping\ServiceProvider; class GiftWrappingServiceProvider implements ServiceProviderInterface { public
function register(BaseApplication $app) { // ཧը໘ $app->match('/' . $app['config']['admin_route'] . '/plugin/giftwrapping/config', 'Plugin\GiftWrapping\Controller\ConfigController::index')- >bind('plugin_GiftWrapping_config'); $app->match('/plugin/giftwrapping/checkout', 'Plugin\GiftWrapping\Controller\GiftWrappingController::index')->bind('plugin_giftwrapping_index'); // Form $app['form.types'] = $app->share($app->extend('form.types', function ($types) use ($app) { $types[] = new GiftWrappingConfigType($app); return $types; })); // Form Extension $app['form.type.extensions'] = $app->share($app->extend('form.type.extensions', function ($extensions) use ($app) { $extensions[] = new ShoppingTypeExtension($app); return $extensions; })); // Repository $app['eccube.plugin.repository.wrapping'] = $app->share(function () use ($app) { return $app['orm.em']->getRepository('Plugin\GiftWrapping\Entity\Wrapping'); }); // Service $app['eccube.plugin.service.gift_wrapping'] = $app->share(function () use ($app) { return new \Plugin\GiftWrapping\Service\GiftWrappingService($app); }); // ϝοηʔδొ $app['translator'] = $app->share($app->extend('translator', function ($translator, \Silex\Application $app) { -
ϓϥάΠϯ༻ཧը໘ͷهड़ class SampleServiceProvider implements ServiceProviderInterface { public function register(BaseApplication $app)
{ // ཧը໘ $app->match('/' . $app['config']['admin_route'] . '/plugin/giftwrapping/config', 'Plugin \GiftWrapping\Controller\ConfigController::index')->bind('plugin_GiftWrapping_config'); // Form $app['form.types'] = $app->share($app->extend('form.types', function ($types) use ($app) { $types[] = new GiftWrappingConfigType($app); return $types; })); } public function boot(BaseApplication $app) { } } -
ରԠϒϥβʹ͍ͭͯ OS ϒϥβ Windows (Windows7Ҏ߱) Internet Explorer10 Ҏ߱ Google Chrome
࠷৽൛ Firefox ࠷৽൛ Mac Safari ࠷৽൛ iOS(7Ҏ߱) Safari ࠷৽൛ Android(4.1Ҏ߱) ඪ४ϒϥβ ࠷৽൛ -
σόοάϞʔυͷ༗ޮԽ • ௨ৗ / /index.phpͰΞΫηε͍ͯ͠Δͱ͜ΖΛ /index_dev.php ͱॻ͖͑ͯΞΫηε͢Δ͜ͱʹΑΓɺtwigϑΝΠϧ͕Ωϟο γϡ͞ΕͣʹσόοάϞʔυ͕༗ޮʹͳΓ·͢ɻ http://localhost/index_dev.php
• You are not allowed to access this file. Check index_dev.php for more information.ͱΤϥʔ͕දࣔ͞ΕΔ߹ɺindex_dev.phpΛ ։͖ɺΞΫηεݩͷIPΛҎԼͷྻʹՃ͍ͯͩ͘͠͞ɻ $allow = array( '127.0.0.1', 'fe80::1', '::1', ); -
ςϯϓϨʔτͷөॱং • σβΠϯςϯϓϨʔτΛ࡞ޙɺϑΝΠϧΛஔ͢Δ σΟϨΫτϦʹΑͬͯ༏ઌॱҐ͕͋Γ·͢ɻҎԼͷॱ ংͰ֘͢ΔςϯϓϨʔτϑΝΠϧ͕ଘࡏ͢Δͱઌʹ ө͞Ε·͢ɻ(ϑϩϯτͷΈͷઆ໌ ) 1. ECCUBEROOT/app/template/default 2.
ECCUBEROOT/src/Eccube/Resource/template/default 3. ECCUBEROOT/app/Plugin/[plugin_code]/Resource/ template/default -
ࠓ͓͠ग़དྷͳ͔ͬͨ͜ͱ • DBͱ࿈ܞͨ͠ϓϥάΠϯ • ৽نʹςʔϒϧΛ࡞͢ΔϓϥάΠϯ • ը໘Λ৽ͨʹ࡞͢ΔϓϥάΠϯ • ը໘ʹରͯ͠ͷઆ໌ •
ଞʹ͋Γ·͕͢·ͨػձ͕͋Ε͓͠͠·͢ɻΑ ͔͘Βͳ͍Αɺͱ͍͏ํޙͰฉ͍͍ͯͩ͘͞ɻ