홈페이지 제작시 해당 페이지를 다른 페이지로 redirect 하기

홈페이지를 제작할때 이미 만들어진 페이지를 새로운 툴을 이용해서 다시 제작할때가 있다. 이미 구글 검색에 이전 URL 링크로 목록에 나타나 잘못된 링크로 클릭하면 문제가 생길 일이 종종 생긴다. 그럴때 유용한 팁이다.

Old 파일주소를 만들어 아래 코드를 넣어보자. head 부분에 이동할 url 을 넣어 강제로 페이지를 redirect 시키는 방법이다.

WordPress and woocommerce integration with native flat shipping set up

Shipping(배송)은 항상 복잡한 내용중의 하나입니다. 그리고 저희가 추천해 드리는 것은 먼저 간단한 flat rate 인데 이것 자체도 저희가 제품을  잘 모르기 때문에 뭐라고 단순히 말씀드리기 쉽지 않습니다.

Shipping 가격은 밑의 내용들로 주로 셋업이 됩니다.

      • 무게, 위치 및 배송 속도에 따른 가변량
      • 고객이 주문한 품목에 관계없이 $ 5.00와 같은 고정 요금
      • 무료 배송
      • In-store pick up

 

배송에 관련해서 잘 알고 계시겠지만 배송업체로는 USPS, UPS 그리고 Fedex가 있지만 모두다 셋업하기도 그렇고  이중에서 하나를 선택하더라도 올리는 모든 제품의 무게와 사이즈가 정확하게 제품에 넣어져야 배송비 계산이 정확하게 이루어 집니다.

여기에 배송 label 까지 인쇄도 직접 가능하지만 이렇게 되면 여러가지 extension 소프트웨어를 플러그인으로 구입하고 서비스도 따로 받아야(subscribe) 합니다. 바로 이부분 때문에 제가 처음에 권해드리는 것은 가격에 따라 flat shipping  fee($5-10) 으로 먼저 시작하는게 좋을듯 합니다. 

사이트의 트랜젝션이 늘어나서 어느 정도의 수준에 오르면 그때 더 쉽핑 서비스를 더하고 개선해도  좋을듯 합니다. 아니면 그전부터 만들어서 한달 사용료 등등을 서비스비용으로 지불하게 되면 사이트 운영비용으로 더 커지게 됩니다.

 

그럼  시핑비를  더하는 기능에 대해서 알려드리겠습니다.

먼저 관리자페이지 로그인하시면 왼쪽 메뉴에서 WooCommerce를 선택하시고 sub menu 에서 Settings를 선택하면 아래의 그림과 같이 나오는데 그중에서 Shipping을 선택하면 됩니다.

그안에서 Shipping Zone을 생성하면 됩니다. 즉 쉽핑주소가 여기서 생성된 지역에 해당되면 자동으로 쉽핑방법이 카트에서 보여주게 되는 경우입니다.

그중에 USPS Regular Shipping을 선택하시면 아래와 같이 수정을 할수 있는 페이지가 나옵니다. 여기서 cost section 은 기본 요금입니다. $1가 기본이고 제품수가 늘어나는 데로 기본 코스트가 늘어 납니다.

예를 들어서 제품 Shipping Class Cost가 $5에 셋업이 되어 있고 제품을 2개를 구매했다고 하면 쉽핑 가격은 1*2 + 5 즉, 7불이 됩니다. (1.00 * [qty] + $5)

 

 

위와 같은 방식으로 USPS  Expedited Shipping 은 아래의 쉽핑 계산 방식으로 만들어 놓을 수 있습니다.

 

기본 베이스 계산은 10 * ( 1.[qty] ) , 즉 1개를 구입하면 기본 가격은 $11에 제품 Shipping Class Cost 를 더하면 됩니다.

예를 들면 밑의 쇼핑카트 처럼 Shipping Class Cost 가 $10인 제품을 3개를 구매하고 Expedited Shipping 을 선택하면 시핑가격은 10*(1.3) +10 =$23 .

 

 

지금까지의 내용처럼  쉽핑 옵션을 셋업하는 방법이었습니다.

 

밑의 스탭들은 제품에 특정 배송가격을 정해주기위한 순서들입니다.

먼저 위에서도 설명하였지만.. 제품 자체에는 Shipping Class Cost를 정해줄 수 있습니다.

 

위에 보이는 그림처럼 Shipping Class를 선택하면 됩니다. 그럼 밑의 내용처럼 나옵니다.

 

 

이중에서 “Add Shipping Class” 를 선택하고 새로운 시핑 클래스를 만둘고 왼쪽에 있는 Save버튼을 누르면 됩니다.

이렇게 생성된 클래스를 제품에 직접적으로 연결을 해줘야 합니다.

왼쪽메뉴에 “Products”를 선택하고  아래메뉴로 “All Products”선택하면 됩니다. 그리고 그중에서 원하는 제품을 선택후  Shipping 을 선택하고 그중에서 “Shipping  Class”를 맞게 선택하면 됩니다.

 

그 이외에 지역 zone으로 더 디테일하게 프리쉽이나 인스토어 픽업등을 셑업해야 하는 경우는 위의 첫번째 존 샡업에서 주를 선택하여 프리쉽이나 인스토어 픽업등을 더 첨부 할수 있습니다.

 

 

 

 

Sendgrid Java API (샌드그리드 자바 API)로 메일 보내기

샌드그리드를 사용하여 예전부터 이메일을 보내고 있었는데 최근들어 예전 API가 이메일을 발송하지 않아 아무래도 문제가 있는것 같아 새로운 API로 바꾸게 되었다.

사용자 입장에서는 모든게  다 바뀌었고 5-6년전부터 쓰던 API는 하나도 같은게 없었다.  아래의 내용은 샘플과 함께 문제점이 있던것을 고친 내용들이다.

  •  java API jar file download : https://github.com/sendgrid/sendgrid-java/releases/download/4.7.2/sendgrid-java.jar
  •  위의 jar file 만 따로 받아서 사용하면 되는데 그렇게 하면   아래의  error가   런타임에 생긴다.
  • java.lang.SecurityException: Invalid signature file digest for Manifest main attributes    .
  •  이럴때는 가장 쉬운 방법으로는    각종 zip 관련  도구로 META-INT folder 로들어가서  *SF,*.DSF,*RSA 파일들을 모두 지우고 jar 파일을 세이브하면 된다. 아니면 https://github.com/sendgrid/sendgrid-java 에서 코드를 다운받아서  jar 파일을 빌드할때  사이닝 관련된 파일들을 아래와 같이 제외 시킨다.

Maven:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.6</version>
    <executions>
        <execution>
            <id>unpack-dependencies</id>
            <phase>package</phase>
            <goals>
                <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
                <excludeScope>system</excludeScope>
                <excludes>META-INF/*.SF</excludes>
                <excludes>META-INF/*.DSA</excludes>
                <excludes>META-INF/*.RSA</excludes>
                <excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
                <outputDirectory>${project.build.directory}/classes</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

ANT:

  1. <jar destfile="app.jar" basedir="${classes.dir}">
    <zipfileset excludes="META-INF/**/*" src="${lib.dir}/bcprov-jdk16-145.jar"></zipfileset>
    <manifest>
    <attribute name="Main-Class" value="app.Main"/>
    </manifest>
    </jar>

    다음은 간단한 샘플 코드들이이다. Personalization을 사용하여 여러 사람들한테 보내거나 BCC등 예전과는 많이 다른 모습을 보인다. 물론 기본적으로 디렉트 API 에서 웹서비스 API로 바뀐게 확연히 들어난다. 

  2. import com.sendgrid.Method;
    import com.sendgrid.Request;
    import com.sendgrid.Response;
    import com.sendgrid.SendGrid;
    import com.sendgrid.helpers.mail.Mail;
    import com.sendgrid.helpers.mail.objects.*;
    import java.io.IOException;
    public class Example {
    // Fully populated Mail object
    public static Mail buildKitchenSink() {
    Mail mail = new Mail();
    Email fromEmail = new Email();
    fromEmail.setName(Example User);
    fromEmail.setEmail(test@example.com);
    mail.setFrom(fromEmail);
    mail.setSubject(Hello World from the Twilio SendGrid Java Library);
    Personalization personalization = new Personalization();
    Email to = new Email();
    to.setName(Example User);
    to.setEmail(test1@example.com);
    personalization.addTo(to);
    to.setName(Example User);
    to.setEmail(test2@example.com);
    personalization.addTo(to);
    Email cc = new Email();
    cc.setName(Example User);
    cc.setEmail(test3@example.com);
    personalization.addCc(cc);
    cc.setName(Example User);
    cc.setEmail(test4@example.com);
    personalization.addCc(cc);
    Email bcc = new Email();
    bcc.setName(Example User);
    bcc.setEmail(test5@example.com);
    personalization.addBcc(bcc);
    bcc.setName(Example User);
    bcc.setEmail(test6@example.com);
    personalization.addBcc(bcc);
    personalization.setSubject(Hello World from the Personalized Twilio SendGrid Java Library);
    personalization.addHeader(X-Test, test);
    personalization.addHeader(X-Mock, true);
    personalization.addSubstitution(%name%, Example User);
    personalization.addSubstitution(%city%, Riverside);
    personalization.addCustomArg(user_id, 343);
    personalization.addCustomArg(type, marketing);
    personalization.setSendAt(1443636843);
    mail.addPersonalization(personalization);
    Personalization personalization2 = new Personalization();
    Email to2 = new Email();
    to2.setName(Example User);
    to2.setEmail(test1@example.com);
    personalization2.addTo(to2);
    to2.setName(Example User);
    to2.setEmail(test2@example.com);
    personalization2.addTo(to2);
    Email cc2 = new Email();
    cc2.setName(Example User);
    cc2.setEmail(test3@example.com);
    personalization2.addCc(cc2);
    cc2.setName(Example User);
    cc2.setEmail(test4@example.com);
    personalization2.addCc(cc2);
    Email bcc2 = new Email();
    bcc2.setName(Example User);
    bcc2.setEmail(test5@example.com);
    personalization2.addBcc(bcc2);
    bcc2.setName(Example User);
    bcc2.setEmail(test6@example.com);
    personalization2.addBcc(bcc2);
    personalization2.setSubject(Hello World from the Personalized Twilio SendGrid Java Library);
    personalization2.addHeader(X-Test, test);
    personalization2.addHeader(X-Mock, true);
    personalization2.addSubstitution(%name%, Example User);
    personalization2.addSubstitution(%city%, Denver);
    personalization2.addCustomArg(user_id, 343);
    personalization2.addCustomArg(type, marketing);
    personalization2.setSendAt(1443636843);
    mail.addPersonalization(personalization2);
    Content content = new Content();
    content.setType(text/plain);
    content.setValue(some text here);
    mail.addContent(content);
    content.setType(text/html);
    content.setValue(<html><body>some text here</body></html>);
    mail.addContent(content);
    Attachments attachments = new Attachments();
    attachments.setContent(TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12);
    attachments.setType(application/pdf);
    attachments.setFilename(balance_001.pdf);
    attachments.setDisposition(attachment);
    attachments.setContentId(Balance Sheet);
    mail.addAttachments(attachments);
    Attachments attachments2 = new Attachments();
    attachments2.setContent(BwdW);
    attachments2.setType(image/png);
    attachments2.setFilename(banner.png);
    attachments2.setDisposition(inline);
    attachments2.setContentId(Banner);
    mail.addAttachments(attachments2);
    mail.setTemplateId(13b8f94f-bcae-4ec6-b752-70d6cb59f932);
    mail.addSection(%section1%, Substitution Text for Section 1);
    mail.addSection(%section2%, Substitution Text for Section 2);
    mail.addHeader(X-Test1, 1);
    mail.addHeader(X-Test2, 2);
    mail.addCategory(May);
    mail.addCategory(2016);
    mail.addCustomArg(campaign, welcome);
    mail.addCustomArg(weekday, morning);
    mail.setSendAt(1443636842);
    ASM asm = new ASM();
    asm.setGroupId(99);
    asm.setGroupsToDisplay(new int[]{4, 5, 6, 7, 8});
    mail.setASM(asm);
    // This must be a valid [batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html) to work
    // mail.setBatchId(“sendgrid_batch_id”);
    mail.setIpPoolId(23);
    MailSettings mailSettings = new MailSettings();
    BccSettings bccSettings = new BccSettings();
    bccSettings.setEnable(true);
    bccSettings.setEmail(test@example.com);
    mailSettings.setBccSettings(bccSettings);
    Setting sandBoxMode = new Setting();
    sandBoxMode.setEnable(true);
    mailSettings.setSandboxMode(sandBoxMode);
    Setting bypassListManagement = new Setting();
    bypassListManagement.setEnable(true);
    mailSettings.setBypassListManagement(bypassListManagement);
    FooterSetting footerSetting = new FooterSetting();
    footerSetting.setEnable(true);
    footerSetting.setText(Footer Text);
    footerSetting.setHtml(<html><body>Footer Text</body></html>);
    mailSettings.setFooterSetting(footerSetting);
    SpamCheckSetting spamCheckSetting = new SpamCheckSetting();
    spamCheckSetting.setEnable(true);
    spamCheckSetting.setSpamThreshold(1);
    spamCheckSetting.setPostToUrl(https://spamcatcher.sendgrid.com);
    mailSettings.setSpamCheckSetting(spamCheckSetting);
    mail.setMailSettings(mailSettings);
    TrackingSettings trackingSettings = new TrackingSettings();
    ClickTrackingSetting clickTrackingSetting = new ClickTrackingSetting();
    clickTrackingSetting.setEnable(true);
    clickTrackingSetting.setEnableText(true);
    trackingSettings.setClickTrackingSetting(clickTrackingSetting);
    OpenTrackingSetting openTrackingSetting = new OpenTrackingSetting();
    openTrackingSetting.setEnable(true);
    openTrackingSetting.setSubstitutionTag(Optional tag to replace with the open image in the body of the message);
    trackingSettings.setOpenTrackingSetting(openTrackingSetting);
    SubscriptionTrackingSetting subscriptionTrackingSetting = new SubscriptionTrackingSetting();
    subscriptionTrackingSetting.setEnable(true);
    subscriptionTrackingSetting.setText(text to insert into the text/plain portion of the message);
    subscriptionTrackingSetting.setHtml(<html><body>html to insert into the text/html portion of the message</body></html>);
    subscriptionTrackingSetting.setSubstitutionTag(Optional tag to replace with the open image in the body of the message);
    trackingSettings.setSubscriptionTrackingSetting(subscriptionTrackingSetting);
    GoogleAnalyticsSetting googleAnalyticsSetting = new GoogleAnalyticsSetting();
    googleAnalyticsSetting.setEnable(true);
    googleAnalyticsSetting.setCampaignSource(some source);
    googleAnalyticsSetting.setCampaignTerm(some term);
    googleAnalyticsSetting.setCampaignContent(some content);
    googleAnalyticsSetting.setCampaignName(some name);
    googleAnalyticsSetting.setCampaignMedium(some medium);
    trackingSettings.setGoogleAnalyticsSetting(googleAnalyticsSetting);
    mail.setTrackingSettings(trackingSettings);
    Email replyTo = new Email();
    replyTo.setName(Example User);
    replyTo.setEmail(test@example.com);
    mail.setReplyTo(replyTo);
    return mail;
    }
    // API V3 Dynamic Template implementation
    public static Mail buildDynamicTemplate() {
    Mail mail = new Mail();
    Email fromEmail = new Email();
    fromEmail.setName(Example User);
    fromEmail.setEmail(test@example.com);
    mail.setFrom(fromEmail);
    mail.setTemplateId(d-c6dcf1f72bdd4beeb15a9aa6c72fcd2c);
    Personalization personalization = new Personalization();
    personalization.addDynamicTemplateData(name, Example User);
    personalization.addDynamicTemplateData(city, Denver);
    personalization.addTo(new Email(test@example.com));
    mail.addPersonalization(personalization);
    return mail;
    }
    // Minimum required to send an email
    public static Mail buildHelloEmail() {
    Email from = new Email(test@example.com);
    String subject = Hello World from the Twilio SendGrid Java Library;
    Email to = new Email(test@example.com);
    Content content = new Content(text/plain, some text here);
    // Note that when you use this constructor an initial personalization object
    // is created for you. It can be accessed via
    // mail.personalization.get(0) as it is a List object
    Mail mail = new Mail(from, subject, to, content);
    Email email = new Email(test2@example.com);
    mail.personalization.get(0).addTo(email);
    return mail;
    }
    public static void baselineExample() throws IOException {
    final Mail helloWorld = buildHelloEmail();
    send(helloWorld);
    }
    public static void kitchenSinkExample() throws IOException {
    final Mail kitchenSink = buildKitchenSink();
    send(kitchenSink);
    }
    public static void dynamicTemplateExample() throws IOException {
    final Mail dynamicTemplate = buildDynamicTemplate();
    send(dynamicTemplate);
    }
    private static void send(final Mail mail) throws IOException {
    final SendGrid sg = new SendGrid(System.getenv(SENDGRID_API_KEY));
    sg.addRequestHeader(X-Mock, true);
    final Request request = new Request();
    request.setMethod(Method.POST);
    request.setEndpoint(mail/send);
    request.setBody(mail.build());
    final Response response = sg.api(request);
    System.out.println(response.getStatusCode());
    System.out.println(response.getBody());
    System.out.println(response.getHeaders());
    }
    public static void main(String[] args) throws IOException {
    baselineExample();
    kitchenSinkExample();
    dynamicTemplateExample();
    }
    }

크롬(Chrome browser) 브라우져 풀스크린(Full Screen)으로 바꾸기

크롬 브라우져나 기타 다른 브라우져를 앱으로 사용할때 특히 URL을 보여주고 싶지 않을때 풀 스크린으로 바꾸어 주는 것이 완성된 앱으로서의 기본적인 사항일 것이다.

다음은 크롬 브라우져를 풀스크린으로 바꾸는 방법이다.

  1. 키보드에서 F11  키를 누르면 바로 풀스크린으로 바뀐다.
  2. 브라우져 맨위 오른쪽 끝에 점 3개를 크릭하면 옵션메뉴가 나오고 중간에 사각형 아이콘을 클릭하면 풀스크린으로 바뀐다.
크롬옵션오픈
크롬옵션오픈
크롬풀스크린 옵션
크롬풀스크린 옵션
  1. 아래의 자바스크립으로 위의 #1, #2를 하지 않고도 풀스크린으로 바꿀수 있다.<script>

    function myFullFunction() {

    var docElm = document.documentElement;
    if (docElm.requestFullscreen) {
    docElm.requestFullscreen();
    }
    else if (docElm.mozRequestFullScreen) {
    docElm.mozRequestFullScreen();
    }
    else if (docElm.webkitRequestFullScreen) {

    docElm.webkitRequestFullScreen();
    }

    }

    </script>

<body onload=”myFullFunction()”>

 

하지만 위의 코드가 문제가 될수 있다. 테이블릿이나 전화기 또는 크롬북 등에서는

“Failed to execute ‘requestFullScreen’ on ‘Element’: API can only be initiated by a user gesture.”

즉 어떤 이벤트라도 만들어야만 제대로 작동할 수 있는 것이기 때문이다.

아직 특별히 다른 방법은 찿지 못했지만 아래의 방식으로 워크어라운드 할 수 있지만 권장하지는 않는다.

 

function toggleFullScreen() {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen();
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
}
}
}

document.addEventListener(“keypress”, function(e) {
if (e.keyCode === 13) {
toggleFullScreen();
}
}, false);

즉 앤터키나 리턴키를 다시 클릭해야만 하기 때문이다.

 

이렇게 풀스크린에서 다시 일반모드로 돌아갈려면 위의 #1 혹은 #2 를 하거나  마우스 커서를 브라우져 스크린 맨위쪽으로 옮기면 다시 정상모드로 돌아 갈수 있는 X자 표시를 클릭하면 된다.

 

 

Tag : HTML

 

  1. CODE RESULT
    <table border=”1″ bgcolor=”#cccccc”>
    <tr>
    <td> Hello
    </td>
    </tr>
    </table>
    Hello

     

  2. CODE RESULT
    <table width=”160″ border=”1″>
    <tr>
    <td width=”50%” align=”center” bgcolor=”blue”>
    Hello1 </td>
    <td width=”50%” align=”center” bgcolor=”green”>
    Hello2 </td>
    </tr>
    </table>
    Hello1 Hello2
  3. CODE RESULT
    <table width=”160″ border=”1″>
    <tr>
    <td width=”50%” align=”center” bgcolor=”blue”>
    Title1 </td>
    <td width=”50%” align=”center” bgcolor=”green”>
    Title2 </td>
    </tr>
    <tr>
    <td align=”center”>
    Hello1 </td>
    <td align=”center”>
    Hello2 </td>
    </tr>
    </table>
    Title1 Title2
    Hello1 Hello2
  4. CODE RESULT
    <table width=”160″ border=”1″>
    <tr>
    <td width=”100%” align=”center” bgcolor=”blue” colspan=”2″>
    Title </td>
    </tr>
    <tr>
    <td width=”50%” align=”center”>
    Hello1 </td>
    <td width=”50%” align=”center”>
    Hello2 </td>
    </tr>
    </table>
    Title
    Hello1 Hello2
  5. CODE RESULT
    <table width=”160″ border=”1″>
    <tr>
    <td width=”50%” align=”center” bgcolor=”blue” rowspan=”2″>
    Title </td>
    <td width=”50%” align=”center”>
    Hello1 </td>
    </tr>
    <tr>
    <td align=”center”>
    Hello2 </td>
    </tr>
    </table>
    Title Hello1
    Hello2
  6. CODE RESULT
    <table border=”1″ style=”background-color:orange;border:1px dotted black;width:160;border-collapse:collapse;”>
    <tr style=”color:white;background-color:red;”>
    <td style=”padding:10px;align:center;width:50%”>
    Title1 </td>
    <td style=”padding:10px;align:center;width:50%”>
    Title2 </td>
    </tr>
    <tr style=”color:white;background-color:green;”>
    <td style=”padding:10px;”>
    Hello1 </td>
    <td style=”padding:10px;”>
    Hello2 </td>
    </tr>
    </table>
    Title1 Title2
    Hello1 Hello2

 

도메인 이름을 서치엔진에 어떻게 등록하나요? (How Do I Register a Domain Name to a Search Engine?)

 

도메인 이름(Domain Name) 을 사고 나서 웹사이트(Web site)를 꾸민 다음으로 가장 중요한 일이 각종 서치 엔진(Search Engine)에 등록(Register)하여 도메인 이름만 쳐도 바로 첫장에 나오게 하는 것입니다.

많은 분들이 SEO(Search Engine Optimization) 에 많이 알고 계시지만 전문적으로 하기에는 시간과 노력이 많이 필요로 하는 부분입니다.
하지만 도메인 이름을 각종 검색엔진에 등록하는 정도는 본인이 손쉽게 하실 수 있습니다.

물론 시간이 지나면 자동으로 등록이 되겠지만 처음에 트레픽(Traffic)이 없는 경우에는 이렇게라도 해서 첯 페이지에 사이트 이름으로 검색했을 경우 바로 나오게 하는 방법이 있습니다.

기존에는 야후(Yahoo), MSN, 구글(Google), 그리고 DMOZ 등이었지만 이제는 빙과 구글만 등록해도 됩니다. 즉 야후(Yahoo)와 빙(Bing)은 같은 검색엔진이고 디모즈는 디렉토리 컨셉이라 이전에는 중요했지만 지금은 너무 많아져 큰 효과가 없을 것입니다.

그럼 밑의 두 검색엔진 링크에 가셔서 등록 하시면 됩니다.

구글 (Google)

빙 (Bing)

error: Content is protected !!